Skip to content

Commit 2c95731

Browse files
committed
Fable support
1 parent 5a72e58 commit 2c95731

File tree

125 files changed

+5491
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+5491
-292
lines changed

.vscode/launch.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@
7575
},
7676
"justMyCode": true,
7777
"enableStepFiltering": false,
78+
},
79+
{
80+
"name": "FCS-Fable Test",
81+
"type": "coreclr",
82+
"request": "launch",
83+
"program": "${workspaceFolder}/artifacts/bin/fcs-fable-test/Debug/net6.0/fcs-fable-test.dll",
84+
"args": [],
85+
"cwd": "${workspaceFolder}/fcs/fcs-fable/test",
86+
"console": "internalConsole",
87+
"stopAtEntry": false
7888
}
7989
]
8090
}

buildtools/AssemblyCheck/AssemblyCheck.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
77
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>
88
</PropertyGroup>

buildtools/buildtools.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
BeforeTargets="CoreCompile">
2121

2222
<PropertyGroup>
23-
<FsLexPath Condition="'$(FsLexPath)' == ''">$(ArtifactsDir)\Bootstrap\fslex\fslex.dll</FsLexPath>
23+
<FsLexPath Condition="'$(FsLexPath)' == ''">$(ArtifactsDir)\bin\fslex\Release\net6.0\fslex.dll</FsLexPath>
2424
</PropertyGroup>
2525

2626
<!-- Create the output directory -->
@@ -44,7 +44,7 @@
4444
BeforeTargets="CoreCompile">
4545

4646
<PropertyGroup>
47-
<FsYaccPath Condition="'$(FsYaccPath)' == ''">$(ArtifactsDir)\Bootstrap\fsyacc\fsyacc.dll</FsYaccPath>
47+
<FsYaccPath Condition="'$(FsYaccPath)' == ''">$(ArtifactsDir)\bin\fsyacc\Release\net6.0\fsyacc.dll</FsYaccPath>
4848
</PropertyGroup>
4949

5050
<!-- Create the output directory -->

buildtools/fslex/fslex.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<DefineConstants>INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants)</DefineConstants>
77
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
88
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>

buildtools/fsyacc/fsyacc.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<DefineConstants>INTERNALIZED_FSLEXYACC_RUNTIME;$(DefineConstants)</DefineConstants>
77
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
88
<UseAppHost Condition="'$(DotNetBuildFromSource)' == 'true'">false</UseAppHost>

fcs/build.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# cd to root
4+
cd $(dirname $0)/..
5+
6+
# build fslex/fsyacc tools
7+
dotnet build -c Release buildtools
8+
# build FSharp.Compiler.Service (to make sure it's not broken)
9+
dotnet build -c Release src/Compiler
10+
11+
# build FCS-Fable codegen
12+
cd fcs/fcs-fable/codegen
13+
dotnet build -c Release
14+
dotnet run -c Release -- ../../../src/Compiler/FSComp.txt FSComp.fs
15+
dotnet run -c Release -- ../../../src/Compiler/Interactive/FSIstrings.txt FSIstrings.fs
16+
17+
# cleanup comments
18+
files="FSComp.fs FSIstrings.fs"
19+
for file in $files; do
20+
echo "Delete comments in $file"
21+
sed -i '1s/^\xEF\xBB\xBF//' $file # remove BOM
22+
sed -i '/^ *\/\//d' $file # delete all comment lines
23+
done
24+
25+
# replace all #line directives with comments
26+
files="lex.fs pplex.fs illex.fs ilpars.fs pars.fs pppars.fs"
27+
for file in $files; do
28+
echo "Replace #line directives with comments in $file"
29+
sed -i 's/^# [0-9]/\/\/\0/' $file # comment all #line directives
30+
sed -i 's/^\(\/\/# [0-9]\{1,\} "\).*\/codegen\/\(\.\.\/\)*/\1/' $file # cleanup #line paths
31+
done
32+
33+
# build FCS-Fable
34+
cd ..
35+
dotnet build -c Release
36+
37+
# run some tests
38+
cd test
39+
npm test
40+
# npm run bench

fcs/fcs-fable/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Codegen
2+
codegen/*.fs
3+
codegen/*.fsi

0 commit comments

Comments
 (0)