aboutsummaryrefslogtreecommitdiff
path: root/ClojureCLR/Clojure
diff options
context:
space:
mode:
Diffstat (limited to 'ClojureCLR/Clojure')
-rw-r--r--ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj65
-rw-r--r--ClojureCLR/Clojure/BootstrapCompile/Compile.cs75
-rw-r--r--ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs36
-rw-r--r--ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj73
-rw-r--r--ClojureCLR/Clojure/Clojure.Main/Main.cs38
-rw-r--r--ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs36
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/FixtureSetupClass.cs19
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/LazySeqTests.cs12
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/LibTests/StreamTests.cs22
-rw-r--r--ClojureCLR/Clojure/Clojure.Tests/ReaderTests/LineNumberingTextReaderTests.cs251
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/core_print.clj317
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/main.clj337
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/set.clj148
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/version.properties5
-rw-r--r--ClojureCLR/Clojure/Clojure/Bootstrap/zip.clj278
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/AFnImplGenerator.cs81
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/AssignExpr.cs80
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/AssignableExpr.cs23
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/BindingInit.cs42
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/BodyExpr.cs121
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/BooleanExpr.cs60
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/ConstantExpr.cs84
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/DefExpr.cs129
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/EmptyExpr.cs83
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/Expr.cs29
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/FieldExpr.cs27
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/FnExpr.cs814
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/FnMethod.cs347
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/GenContext.cs115
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/HostExpr.cs248
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/IParser.cs22
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/IfExpr.cs193
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/ImportExpr.cs76
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/InstanceFieldExpr.cs133
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/InstanceMethodExpr.cs102
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/InvokeExpr.cs132
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/KeywordExpr.cs59
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/LetExpr.cs180
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/LetFnExpr.cs149
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/LiteralExpr.cs25
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/LocalBinding.cs114
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/LocalBindingExpr.cs74
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/MapExpr.cs78
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/MaybePrimitiveExpr.cs23
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/MetaExpr.cs69
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/MethodExpr.cs23
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/MonitorEnterExpr.cs60
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/MonitorExitExpr.cs59
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/NewExpr.cs139
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/NilExpr.cs53
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/Node.cs68
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/RecurExpr.cs124
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/SetExpr.cs77
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/StaticFieldExpr.cs90
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/StaticMethodExpr.cs107
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/StringExpr.cs59
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/TheVarExpr.cs75
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/ThrowExpr.cs66
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/TryExpr.cs214
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/UnresolvedVarExpr.cs59
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/UntypedExpr.cs30
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/VarExpr.cs80
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Ast/VectorExpr.cs75
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Compiler.cs1297
-rw-r--r--ClojureCLR/Clojure/Clojure/CljCompiler/Generator.cs2511
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/ArrayHelper.cs68
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/LazySeq.cs272
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Seqable.cs29
-rw-r--r--ClojureCLR/Clojure/Clojure/Lib/Stream.cs152
-rw-r--r--ClojureCLR/Clojure/Clojure/Readers/LineNumberingTextReader.cs205
-rw-r--r--ClojureCLR/Clojure/Clojure/Readers/PushbackTextReader.cs92
-rw-r--r--ClojureCLR/Clojure/Clojure/Resources/version.txt0
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/ClojureConsoleOptions.cs13
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/ClojureHostUtils.cs37
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/ClojureOptionsParser.cs12
-rw-r--r--ClojureCLR/Clojure/Clojure/Runtime/Properties.cs67
-rw-r--r--ClojureCLR/Clojure/Clojure/app.config3
-rw-r--r--ClojureCLR/Clojure/Simple.Console/Properties/AssemblyInfo.cs36
-rw-r--r--ClojureCLR/Clojure/Simple.Console/Simple.Console.csproj73
-rw-r--r--ClojureCLR/Clojure/Simple.Console/SimpleConsole.cs108
80 files changed, 11857 insertions, 0 deletions
diff --git a/ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj b/ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj
new file mode 100644
index 00000000..fac50dff
--- /dev/null
+++ b/ClojureCLR/Clojure/BootstrapCompile/BootstrapCompile.csproj
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{3DBF3359-43B5-47C9-9E4D-CF50D7587F20}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>BootstrapCompile</RootNamespace>
+ <AssemblyName>BootstrapCompile</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Compile.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Clojure\Clojure.csproj">
+ <Project>{B8089F66-DFBD-4906-BEE0-B317689C2524}</Project>
+ <Name>Clojure</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/ClojureCLR/Clojure/BootstrapCompile/Compile.cs b/ClojureCLR/Clojure/BootstrapCompile/Compile.cs
new file mode 100644
index 00000000..72e09221
--- /dev/null
+++ b/ClojureCLR/Clojure/BootstrapCompile/Compile.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using clojure.lang;
+using System.Collections;
+using System.Diagnostics;
+
+namespace BootstrapCompile
+{
+ static class Compile
+ {
+
+ const string PATH_PROP = "clojure.compile.path";
+ const string REFLECTION_WARNING_PROP = "clojure.compile.warn-on-reflection";
+
+ static void Main(string[] args)
+ {
+ TextWriter outTW = (TextWriter)RT.OUT.deref();
+ TextWriter errTW = (TextWriter)RT.ERR.deref();
+
+ string path = Environment.GetEnvironmentVariable(PATH_PROP);
+ // TODO: get rid of this when we have the full build process set up
+ path = path ?? ".";
+
+ if ( path == null )
+ {
+ errTW.WriteLine("ERROR: Must set system property {0}",PATH_PROP);
+ errTW.WriteLine("to the location for the compiled .class files.");
+ errTW.WriteLine("This directory must also be on your {0}.",RT.CLOJURE_LOAD_PATH);
+ Environment.Exit(1);
+ }
+
+ string warnVal = Environment.GetEnvironmentVariable(REFLECTION_WARNING_PROP);
+ bool warnOnReflection = warnVal == null ? false : warnVal.Equals(true);
+
+ try
+ {
+ Var.pushThreadBindings(RT.map(
+ Compiler.COMPILE_PATH,path,
+ RT.WARN_ON_REFLECTION,warnOnReflection
+ ));
+
+ Stopwatch sw = new Stopwatch();
+
+ foreach ( string lib in args )
+ {
+ sw.Reset();
+ sw.Start();
+ outTW.Write("Compiling {0} to {1}",lib,path);
+ outTW.Flush();
+ Compiler.COMPILE.invoke(Symbol.intern(lib));
+ sw.Stop();
+ outTW.WriteLine(" -- {0} milliseconds.", sw.ElapsedMilliseconds);
+ }
+ }
+ finally
+ {
+ Var.popThreadBindings();
+ try {
+ outTW.Flush();
+ outTW.Close();
+ }
+ catch ( IOException e)
+ {
+ errTW.WriteLine(e.StackTrace);
+ }
+ }
+
+
+
+ }
+ }
+}
diff --git a/ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs b/ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..d34a0349
--- /dev/null
+++ b/ClojureCLR/Clojure/BootstrapCompile/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("BootstrapCompile")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BootstrapCompile")]
+[assembly: AssemblyCopyright("Copyright © 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5cd7f55f-06b5-4520-af3e-936776803b57")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj b/ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj
new file mode 100644
index 00000000..3006d806
--- /dev/null
+++ b/ClojureCLR/Clojure/Clojure.Main/Clojure.Main.csproj
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A9B3BA9E-6955-43E6-9846-54DEFEDCFBFC}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Clojure.Main</RootNamespace>
+ <AssemblyName>Clojure.Main</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\DLR_Main\Src\Runtime\Microsoft.Scripting.Core\Microsoft.Scripting.Core.csproj">
+ <Project>{2AE75F5A-CD1F-4925-9647-AF4D1C282FB4}</Project>
+ <Name>Microsoft.Scripting.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\DLR_Main\Src\Runtime\Microsoft.Scripting\Microsoft.Scripting.csproj">
+ <Project>{EB66B766-6354-4208-A3D4-AACBDCB5C3B3}</Project>
+ <Name>Microsoft.Scripting</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Clojure\Clojure.csproj">
+ <Project>{B8089F66-DFBD-4906-BEE0-B317689C2524}</Project>
+ <Name>Clojure</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/ClojureCLR/Clojure/Clojure.Main/Main.cs b/ClojureCLR/Clojure/Clojure.Main/Main.cs
new file mode 100644
index 00000000..e98d9afc
--- /dev/null
+++ b/ClojureCLR/Clojure/Clojure.Main/Main.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using clojure.lang;
+
+namespace Clojure
+{
+ public static class CljMain
+ {
+ private static readonly Symbol CLOJURE_MAIN = Symbol.intern("clojure.main");
+ private static readonly Var REQUIRE = RT.var("clojure.core", "require");
+ private static readonly Var LEGACY_REPL = RT.var("clojure.main", "legacy-repl");
+ private static readonly Var LEGACY_SCRIPT = RT.var("clojure.main", "legacy-script");
+ private static readonly Var MAIN = RT.var("clojure.main", "main");
+
+ static void Main(string[] args)
+ {
+ REQUIRE.invoke(CLOJURE_MAIN);
+ MAIN.applyTo(RT.seq(args));
+ }
+
+ static void legacy_repl(string[] args)
+ {
+ REQUIRE.invoke(CLOJURE_MAIN);
+ LEGACY_REPL.invoke(RT.seq(args));
+
+ }
+
+ static void legacy_script(string[] args)
+ {
+ REQUIRE.invoke(CLOJURE_MAIN);
+ LEGACY_SCRIPT.invoke(RT.seq(args));
+ }
+
+
+ }
+}
diff --git a/ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs b/ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..e355cc52
--- /dev/null
+++ b/ClojureCLR/Clojure/Clojure.Main/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Clojure.Main")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Clojure.Main")]
+[assembly: AssemblyCopyright("Copyright © 2009")]
+[assembly: AssemblyTrademark("")]