-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This cut-down compiler can be used to compile lthe standard library.
- Loading branch information
1 parent
2e3c646
commit 296415a
Showing
10 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.scmproj'">$(MSBuildThisFileDirectory)../src/Feersum.Sdk/targets/Feersum.Sdk.targets</LanguageTargets> | ||
</PropertyGroup> | ||
|
||
<!-- Config for our language targets. We don't want to pull in a compiler from | ||
NuGet but instead want to dogfood the current build outputs. --> | ||
<PropertyGroup> | ||
<NoImplicitFeersumCoreReference>true</NoImplicitFeersumCoreReference> | ||
<CompilerConfiguration>$(Configuration)</CompilerConfiguration> | ||
<CompilerConfiguration Condition=" '$(CompilerConfiguration)' == '' ">Debug</CompilerConfiguration> | ||
<FeersumCompilerPath>$(MSBuildThisFileDirectory)..\src\Feersum.Stage1\bin\$(CompilerConfiguration)\net5.0\Feersum.Stage1.dll</FeersumCompilerPath> | ||
</PropertyGroup> | ||
|
||
<!-- Reference the compiler so we have it built and can run it. Refernece our | ||
core library so `dotnet` copies it to the output directory. --> | ||
<ItemGroup> | ||
<ProjectReference Include="$(MSBuildThisFileDirectory)..\src\Serehfa\Serehfa.csproj" /> | ||
<ProjectReference Include="$(MSBuildThisFileDirectory)..\src\Feersum.Stage1\Feersum.Stage1.fsproj"> | ||
<Private>False</Private> | ||
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> | ||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
<CopyToOutputDirectory>false</CopyToOutputDirectory> | ||
<CopyToPublishDirectory>false</CopyToPublishDirectory> | ||
</ProjectReference> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Argu" Version="6.1.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Feersum.CompilerServices\Feersum.CompilerServices.fsproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
open Argu.ArguAttributes | ||
open Argu | ||
|
||
open Feersum.CompilerServices.Diagnostics | ||
open Feersum.CompilerServices.Options | ||
open Feersum.CompilerServices.Compile | ||
|
||
/// Command line arguments type. Cut-down stage1 compiler options | ||
type CliArguments = | ||
| Configuration of BuildConfiguration | ||
| OutputType of OutputType | ||
| CoreLibPath of string | ||
| GenerateDeps of bool | ||
| [<AltCommandLine("-r")>] Reference of string | ||
| [<AltCommandLine("-o")>] Output of string | ||
| [<MainCommand>] Sources of source_file: string list | ||
|
||
interface IArgParserTemplate with | ||
member s.Usage = | ||
match s with | ||
| Configuration _ -> "The build configuration (Debug / Release)." | ||
| OutputType _ -> "The output type (Lib / Exe / Script)." | ||
| CoreLibPath _ -> "Location of mscorelib.dll, or System.Runtime.dll." | ||
| GenerateDeps _ -> "Generate .deps.json and .runtimeconfig.json stubs." | ||
| Reference _ -> "Compiled Scheme assembly to reference." | ||
| Output _ -> "The output path to write compilation results to." | ||
| Sources _ -> "Scheme source files for compilation." | ||
|
||
|
||
[<EntryPoint>] | ||
let main argv = | ||
let parser = | ||
ArgumentParser.Create<CliArguments>(programName = "feersum-stage1") | ||
|
||
let args = parser.Parse(argv) | ||
|
||
let buildConfig = | ||
args.TryGetResult Configuration | ||
|> Option.defaultValue Release | ||
|
||
let outputType = | ||
args.TryGetResult OutputType | ||
|> Option.defaultValue Exe | ||
|
||
let options = | ||
{ CompilationOptions.Create buildConfig outputType with | ||
References = args.GetResults Reference | ||
GenerateDepsFiles = | ||
(args.TryGetResult GenerateDeps) | ||
|> Option.defaultValue true | ||
MsCorePaths = args.GetResults CoreLibPath } | ||
|
||
let diags = Compilation.compileFiles options (args.GetResult(Output)) (args.GetResult(Sources)) | ||
if hasErrors diags then | ||
dumpDiagnostics diags | ||
diags |> List.length | ||
else | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters