Skip to content

Commit

Permalink
Allow entry point function name to be given on command line (#1031)
Browse files Browse the repository at this point in the history
Enhancements:
- Add a new command line argument `--entry`, which allows the name of the entry point function or static method to be specified.
  • Loading branch information
degory authored Jan 26, 2024
1 parent 70870a1 commit d007756
Show file tree
Hide file tree
Showing 80 changed files with 480 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"ghul.compiler": {
"version": "0.6.6",
"version": "0.6.8",
"commands": [
"ghul-compiler"
]
Expand Down
14 changes: 14 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,20 @@
"showReuseMessage": true,
"clear": false
}
},
{
"label": "Run all unit tests",
"type": "shell",
"command": "dotnet test unit-tests",
"group": "test",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
]
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.6.8-alpha.28</Version>
<Version>0.6.9-alpha.33</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run test",
"command": "dotnet ghul-test ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "Capture test expectation",
"command": "../../../tasks/capture.sh ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--dotnet --entry named_entry_point
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello, World!
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
named_entry_point() is
IO.Std.out.write_line("Hello, World!");
si
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>

<GhulCompiler>dotnet ghul-compiler</GhulCompiler>
</PropertyGroup>

<ItemGroup>
<GhulSources Include="**/*.ghul" />
<PackageReference Include="ghul.runtime" />
<PackageReference Include="ghul.pipes" />
<PackageReference Include="ghul.targets" />
</ItemGroup>
</Project>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run test",
"command": "dotnet ghul-test ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "Capture test expectation",
"command": "../../../tasks/capture.sh ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: ilasm failed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--dotnet --entry named_entry_point
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.method public hidebysig static default void 'named_entry_point'() cil managed
{
.entrypoint
.maxstack 64
ret
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Test is
class Main is
@IL.output("il.out")
named_entry_point() static is
si
si
si
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>

<GhulCompiler>dotnet ghul-compiler</GhulCompiler>
</PropertyGroup>

<ItemGroup>
<GhulSources Include="**/*.ghul" />
<PackageReference Include="ghul.runtime" />
<PackageReference Include="ghul.pipes" />
<PackageReference Include="ghul.targets" />
</ItemGroup>
</Project>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run test",
"command": "dotnet ghul-test ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "Capture test expectation",
"command": "../../../tasks/capture.sh ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: ilasm failed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--dotnet --entry named_entry_point
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.method public hidebysig static default void 'named_entry_point'() cil managed
{
.entrypoint
.maxstack 64
ret
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@IL.output("il.out")
named_entry_point() is
si
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>

<GhulCompiler>dotnet ghul-compiler</GhulCompiler>
</PropertyGroup>

<ItemGroup>
<GhulSources Include="**/*.ghul" />
<PackageReference Include="ghul.runtime" />
<PackageReference Include="ghul.pipes" />
<PackageReference Include="ghul.targets" />
</ItemGroup>
</Project>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run test",
"command": "dotnet ghul-test ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "Capture test expectation",
"command": "../../../tasks/capture.sh ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: ilasm failed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--dotnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.method public hidebysig static default void 'entry'() cil managed
{
.entrypoint
.maxstack 64
ret
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Test is
class Main is
@IL.output("il.out")
entry() static is
si
si
si
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>

<GhulCompiler>dotnet ghul-compiler</GhulCompiler>
</PropertyGroup>

<ItemGroup>
<GhulSources Include="**/*.ghul" />
<PackageReference Include="ghul.runtime" />
<PackageReference Include="ghul.pipes" />
<PackageReference Include="ghul.targets" />
</ItemGroup>
</Project>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Run test",
"command": "dotnet ghul-test ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "Capture test expectation",
"command": "../../../tasks/capture.sh ${workspaceFolder}",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error: ilasm failed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compiler": "dotnet ../../../publish/ghul.dll",
"source": [
"."
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--dotnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.method public hidebysig static default void 'entry'() cil managed
{
.entrypoint
.maxstack 64
ret
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@IL.output("il.out")
entry() is
si
Loading

0 comments on commit d007756

Please sign in to comment.