Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run the 39.0 kernel on .NET 8.0. #9

Merged
merged 45 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f1bb92e
Bump the compiler service over 35 and almost to 38.
jaccarmac Nov 23, 2023
be777b3
Upgrade to .NET 5 and Compiler Service 38.
jaccarmac Nov 23, 2023
e2bd854
Handle the changes to long identifiers in FCS 38.
jaccarmac Nov 23, 2023
696d445
Get Kl.Make compiling.
jaccarmac Nov 23, 2023
fae3466
Target net6.0 with the Shen* projects.
jaccarmac Nov 23, 2023
77276d1
Upgrade to FCS 39.
jaccarmac Nov 23, 2023
90541df
Upgrade to FCS 40.
jaccarmac Nov 23, 2023
9e6e0b9
Upgrade to FCS 41.0.7.
jaccarmac Nov 24, 2023
9c9d658
Simplify reference to Kl.
jaccarmac Nov 24, 2023
112001c
Switch all projects over to net6.0.
jaccarmac Nov 24, 2023
3776f87
Fix .NET Standard -> .NET Core warnings.
jaccarmac Nov 24, 2023
0e7a109
Enable type information to be output in lambdas.
jaccarmac Nov 25, 2023
6a1eaf3
Revert typo.
jaccarmac Nov 25, 2023
24e6581
Fix infix applications.
jaccarmac Nov 25, 2023
90200b6
Build the kernel with dotnet instead of FCS.
jaccarmac Nov 25, 2023
b554dba
Bump kernel to 22.4.
jaccarmac Nov 25, 2023
ee1c4ec
Use task blocks.
jaccarmac Nov 26, 2023
2097b68
Fix mangled newlines.
jaccarmac May 11, 2024
dbad6bd
Remove DLL emitter.
jaccarmac May 11, 2024
63ecfa1
Update to .NET 8 and the associated FCS.
jaccarmac May 11, 2024
caa4729
Add stubs for the new S series output model.
jaccarmac May 12, 2024
15cca8b
Target 38.1.
jaccarmac May 12, 2024
0ddc102
Compile source files used by the Lisp loader.
jaccarmac May 12, 2024
d2efe41
shen.repl -> shen.shen for startup.
jaccarmac May 12, 2024
06a23d8
add-macro -> record-macro
jaccarmac May 12, 2024
1724429
Remove call to initialise.
jaccarmac May 12, 2024
25a3eab
FIXME: Add globals necessary to start the REPL.
jaccarmac May 12, 2024
45148de
Use 38.2.
jaccarmac May 12, 2024
fac263b
Load the necessary files from the GitHub source distribution.
jaccarmac May 13, 2024
eed0162
Revert "FIXME: Add globals necessary to start the REPL."
jaccarmac May 13, 2024
eba9b06
Revert "shen.repl -> shen.shen for startup."
jaccarmac May 13, 2024
a6810cb
Revert "Remove call to initialise."
jaccarmac May 13, 2024
a422796
Use the new test entrypoint, runme.shen.
jaccarmac May 13, 2024
288ebef
Use 38.3.
jaccarmac May 13, 2024
1420833
Use postImport on the globals and add arity for exit.
jaccarmac May 13, 2024
b7b6f3c
Instead of exiting the tests, continue and count failures silently.
jaccarmac May 14, 2024
7159282
F# 8.0.300
jaccarmac May 14, 2024
497679f
Add a regression test for the failing let-in-lambda.
jaccarmac May 15, 2024
0ab748e
Add similarly-failing test for freeze.
jaccarmac May 15, 2024
e47efdc
Fix let in lambda and freeze.
jaccarmac May 15, 2024
05cf278
Skip the right side of type expressions.
jaccarmac May 15, 2024
3d1dc6a
Merge branch 'master' into wip-core
jaccarmac Oct 11, 2024
e5dbdd9
Bump kernel to 39.0.
jaccarmac Oct 11, 2024
a0f3727
Ensure non-alphanumeric interns are not symbols.
jaccarmac Oct 15, 2024
4d45967
Bump the badge to 39.0.
jaccarmac Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Shen Version](https://img.shields.io/badge/shen-38.3-blue.svg)](https://github.com/Shen-Language)
[![Shen Version](https://img.shields.io/badge/shen-39.0-blue.svg)](https://github.com/Shen-Language)
[![Latest Nuget](https://img.shields.io/nuget/v/ShenSharp.svg)](https://www.nuget.org/packages/ShenSharp)

# Shen for the Common Language Runtime
Expand Down
10 changes: 7 additions & 3 deletions src/Kl.Get/GetKl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open System
open System.IO
open System.IO.Compression
open System.Net
open System.Net.Http
open ShenSharp.Shared

let url = sprintf "https://github.com/Shen-Language/shen-sources/releases/download/shen-%s/%s.zip" KernelRevision KernelFolderName
Expand All @@ -22,8 +22,12 @@ let main _ =
printfn "Extracted folder: \"%s\"" extractedFolder
printfn "Kernel folder: \"%s\"" kernelFolder
printfn "Downloading sources package..."
use client = new WebClient()
client.DownloadFile(url, zipPath)
(task {
use client = new HttpClient()
use zip = new FileStream(zipPath, FileMode.Create)
let! req = client.GetStreamAsync url
do! req.CopyToAsync zip
}).Wait ()
printfn "Extracting sources package..."
safeDelete kernelFolder
ZipFile.ExtractToDirectory(zipPath, root)
Expand Down
2 changes: 1 addition & 1 deletion src/Kl.Get/Kl.Get.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>Kl.Get</AssemblyName>
<PackageId>Kl.Get</PackageId>
<RootNamespace>Kl</RootNamespace>
Expand Down
35 changes: 17 additions & 18 deletions src/Kl.Make/BuildRuntime.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@ open Kl.Values
open Loader
open ShenSharp.Shared

let outputPath = fromRoot ["kernel"; "dotnet"; BuildConfig]
let sourcePath = fromRoot ["kernel"; "klambda"]
let sourceFiles = [
"toplevel.kl"
"core.kl"
"sys.kl"
"dict.kl"
"sequent.kl"
"yacc.kl"
"reader.kl"
"prolog.kl"
"track.kl"
"load.kl"
"writer.kl"
"macros.kl"
"declarations.kl"
"types.kl"
"t-star.kl"
"init.kl"
"dict.kl"
"sys.kl"
"writer.kl"
"core.kl"
"reader.kl"
"declarations.kl"
"toplevel.kl"
"macros.kl"
"load.kl"
"prolog.kl"
"sequent.kl"
"track.kl"
"t-star.kl"
"yacc.kl"
"types.kl"
"init.kl"
]

let buildRuntime () = make sourcePath sourceFiles outputPath
let buildRuntime () = make sourcePath sourceFiles

[<EntryPoint>]
let main _ = separateThread128MB buildRuntime
2 changes: 1 addition & 1 deletion src/Kl.Make/Compiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,5 @@ let buildMetadataFile name copyright version config =
meta ["System"; "Reflection"; "AssemblyFileVersion"] version
meta ["System"; "Reflection"; "AssemblyInformationalVersion"] <| version.Substring(0, version.Length - 2)
meta ["System"; "Reflection"; "AssemblyConfiguration"] config
meta ["System"; "Runtime"; "Versioning"; "TargetFramework"] ".NETStandard,Version=v2.1"
meta ["System"; "Runtime"; "Versioning"; "TargetFramework"] ".NETCoreApp,Version=v8.0"
]
4 changes: 2 additions & 2 deletions src/Kl.Make/Kl.Make.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyName>Kl.Make</AssemblyName>
<PackageId>Kl.Make</PackageId>
<RootNamespace>Kl</RootNamespace>
Expand All @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="FParsec" Version="1.1.1" />
<PackageReference Include="FSharp.Compiler.Service" Version="34.0.1" />
<PackageReference Include="FSharp.Compiler.Service" Version="43.8.300" />
</ItemGroup>

<ItemGroup>
Expand Down
42 changes: 10 additions & 32 deletions src/Kl.Make/Loader.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

open System
open System.IO
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Diagnostics
open FSharp.Compiler.Text
open Kl
open Kl.Values
Expand All @@ -13,24 +14,24 @@ open ShenSharp.Shared

let private dllName = sprintf "%s.dll" GeneratedModule
let private pdbName = sprintf "%s.pdb" GeneratedModule
let private deps = ["Kl.dll"]
let private deps = ["Kl"; "System.Runtime"; "System.Runtime.Numerics"; "System.Collections"; "System.Net.Requests"; "System.Net.WebClient"]
let private sharedMetadataPath = fromRoot ["src"; "Shared.fs"]

let private import sourcePath =
List.collect (fun f -> combine [sourcePath; f] |> File.ReadAllText |> readAll)

let private filterMessages severity messages = Seq.filter (fun (m: FSharpErrorInfo) -> m.Severity = severity) messages
let private filterMessages severity messages = Seq.filter (fun (m: FSharpDiagnostic) -> m.Severity = severity) messages

let private logWarnings messages =
messages |> filterMessages FSharpErrorSeverity.Warning |> Seq.iter (fun (m: FSharpErrorInfo) -> printfn "%O" m)
messages |> filterMessages FSharpDiagnosticSeverity.Warning |> Seq.iter (fun (m: FSharpDiagnostic) -> printfn "%O" m)

let private raiseErrors messages =
let errors = filterMessages FSharpErrorSeverity.Error messages
let errors = filterMessages FSharpDiagnosticSeverity.Error messages
raise(Exception(String.Join("\r\n\r\n", Seq.map string errors)))

let private handleResults (value, messages) =
logWarnings messages
if filterMessages FSharpErrorSeverity.Error messages |> Seq.length > 0
if filterMessages FSharpDiagnosticSeverity.Error messages |> Seq.length > 0
then raiseErrors messages
else value

Expand All @@ -46,25 +47,8 @@ let private parseFile (checker: FSharpChecker) file =
let result =
checker.ParseFile(file, input, parsingOptions)
|> Async.RunSynchronously
logWarnings result.Errors
match result.ParseTree with
| Some tree -> tree
| None -> raiseErrors result.Errors

// TODO: specify arguments to exclude mscorlib.dll

let private emit (checker: FSharpChecker) asts =
let (errors, _) =
checker.Compile(
asts,
GeneratedModule,
dllName,
deps,
pdbName,
false,
true)
|> Async.RunSynchronously
handleResults ((), errors)
logWarnings result.Diagnostics
result.ParseTree

let private move source destination =
if File.Exists destination then
Expand All @@ -78,16 +62,10 @@ let private filterDefuns excluded =
| _ -> false // Exclude all non-defuns too
List.filter filter

let make sourcePath sourceFiles outputPath =
let make sourcePath sourceFiles =
let checker = FSharpChecker.Create()
let exprs = import sourcePath sourceFiles |> filterDefuns ["cd"]
printfn "Translating kernel..."
let ast = buildInstallationFile GeneratedModule exprs
File.WriteAllText("Kernel.fs", writeFile ast)
let sharedAst = parseFile checker sharedMetadataPath
let metadataAst = buildMetadataFile GeneratedModule Copyright Revision BuildConfig
printfn "Compiling kernel..."
emit checker [ast; sharedAst; metadataAst]
printfn "Copying artifacts to output path..."
move dllName (combine [outputPath; dllName])
printfn "Done."
Loading
Loading