Skip to content

Commit

Permalink
Fable support
Browse files Browse the repository at this point in the history
  • Loading branch information
ncave committed Feb 24, 2023
1 parent e22bc22 commit c66211c
Show file tree
Hide file tree
Showing 125 changed files with 5,574 additions and 288 deletions.
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@
},
"justMyCode": true,
"enableStepFiltering": false,
},
{
"name": "FCS-Fable Test",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/artifacts/bin/fcs-fable-test/Debug/net7.0/fcs-fable-test.dll",
"args": [],
"cwd": "${workspaceFolder}/fcs/fcs-fable/test",
"console": "internalConsole",
"stopAtEntry": false
}
]
}
4 changes: 2 additions & 2 deletions buildtools/buildtools.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
BeforeTargets="CoreCompile">

<PropertyGroup>
<FsLexPath Condition="'$(FsLexPath)' == ''">$(ArtifactsDir)\Bootstrap\fslex\fslex.dll</FsLexPath>
<FsLexPath Condition="'$(FsLexPath)' == ''">$(ArtifactsDir)\bin\fslex\Release\net7.0\fslex.dll</FsLexPath>
</PropertyGroup>

<!-- Create the output directory -->
Expand All @@ -44,7 +44,7 @@
BeforeTargets="CoreCompile">

<PropertyGroup>
<FsYaccPath Condition="'$(FsYaccPath)' == ''">$(ArtifactsDir)\Bootstrap\fsyacc\fsyacc.dll</FsYaccPath>
<FsYaccPath Condition="'$(FsYaccPath)' == ''">$(ArtifactsDir)\bin\fsyacc\Release\net7.0\fsyacc.dll</FsYaccPath>
</PropertyGroup>

<!-- Create the output directory -->
Expand Down
40 changes: 40 additions & 0 deletions fcs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# cd to root
cd $(dirname $0)/..

# build fslex/fsyacc tools
dotnet build -c Release buildtools
# build FSharp.Compiler.Service (to make sure it's not broken)
dotnet build -c Release src/Compiler

# build FCS-Fable codegen
cd fcs/fcs-fable/codegen
dotnet build -c Release
dotnet run -c Release -- ../../../src/Compiler/FSComp.txt FSComp.fs
dotnet run -c Release -- ../../../src/Compiler/Interactive/FSIstrings.txt FSIstrings.fs

# cleanup comments
files="FSComp.fs FSIstrings.fs"
for file in $files; do
echo "Delete comments in $file"
sed -i '1s/^\xEF\xBB\xBF//' $file # remove BOM
sed -i '/^ *\/\//d' $file # delete all comment lines
done

# replace all #line directives with comments
files="lex.fs pplex.fs illex.fs ilpars.fs pars.fs pppars.fs"
for file in $files; do
echo "Replace #line directives with comments in $file"
sed -i 's/^# [0-9]/\/\/\0/' $file # comment all #line directives
sed -i 's/^\(\/\/# [0-9]\{1,\} "\).*\/codegen\/\(\.\.\/\)*/\1/' $file # cleanup #line paths
done

# build FCS-Fable
cd ..
dotnet build -c Release

# run some tests
cd test
npm test
# npm run bench
3 changes: 3 additions & 0 deletions fcs/fcs-fable/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Codegen
codegen/*.fs
codegen/*.fsi
Loading

0 comments on commit c66211c

Please sign in to comment.