Skip to content

Commit 57a54e0

Browse files
committed
Fable support
1 parent 0633603 commit 57a54e0

File tree

95 files changed

+8019
-3602
lines changed

Some content is hidden

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

95 files changed

+8019
-3602
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ artifacts/*.nupkg
192192
*.orig
193193
*.mdf
194194
*.ldf
195-
.paket/paket.exe
195+
fcs/.paket/paket.exe
196196
paket-files
197197
docsrc/tools/FSharp.Formatting.svclog
198198
src/fsharp/FSharp.Compiler.Service/pplex.fs
@@ -202,6 +202,7 @@ src/fsharp/FSharp.Compiler.Service/pppars.fsi
202202
*.cto
203203
*.vstman
204204
project.lock.json
205+
.vscode
205206

206207
src/fsharp/FSharp.Compiler.Service/FSComp.fs
207208
src/fsharp/FSharp.Compiler.Service/FSComp.resx

fcs/build.fsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ Target "BuildVersion" (fun _ ->
8787
Shell.Exec("appveyor", sprintf "UpdateBuild -Version \"%s\"" buildVersion) |> ignore
8888
)
8989

90+
Target "BuildTools" (fun _ ->
91+
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
92+
)
93+
9094
Target "Build" (fun _ ->
9195
runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto"
9296
let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.0/fslex.dll"
@@ -107,6 +111,30 @@ Target "NuGet" (fun _ ->
107111
runDotnet __SOURCE_DIRECTORY__ "pack FSharp.Compiler.Service.sln -v n -c Release"
108112
)
109113

114+
Target "CodeGen.Fable" (fun _ ->
115+
let outDir = __SOURCE_DIRECTORY__ + "/fcs-fable/codegen/"
116+
117+
// build FCS codegen
118+
let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.0/fslex.dll"
119+
let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/netcoreapp2.0/fsyacc.dll"
120+
runDotnet outDir (sprintf "build -v n /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath)
121+
122+
// run FCS fssrgen (without .resx output, inlining it instead)
123+
runDotnet outDir "run -- ../../../src/fsharp/FSComp.txt FSComp.fs"
124+
runDotnet outDir "run -- ../../../src/fsharp/fsi/FSIstrings.txt FSIstrings.fs"
125+
126+
// Fable-specific (comment the #line directive as it is not supported)
127+
["lex.fs"; "pplex.fs"; "illex.fs"; "ilpars.fs"; "pars.fs"; "pppars.fs"]
128+
|> Seq.map (fun fileName -> outDir + fileName)
129+
|> RegexReplaceInFilesWithEncoding @"(?<!/)# (?=\d)" "//# " Text.Encoding.UTF8
130+
131+
// prevent stack overflows on large files (make lexer rules inline)
132+
let pattern = @"(?<=and )(?!inline )([a-zA-Z]+ )+ *\(lexbuf "
133+
["lex.fs"; "pplex.fs"; "illex.fs"]
134+
|> Seq.map (fun fileName -> outDir + fileName)
135+
|> RegexReplaceInFilesWithEncoding pattern @"inline $0" Text.Encoding.UTF8
136+
)
137+
110138
Target "GenerateDocsEn" (fun _ ->
111139
executeFSIWithArgs "docsrc/tools" "generate.fsx" [] [] |> ignore
112140
)
@@ -134,6 +162,10 @@ Target "Release" DoNothing
134162
Target "GenerateDocs" DoNothing
135163
Target "TestAndNuGet" DoNothing
136164

165+
"Clean"
166+
==> "BuildTools"
167+
==> "CodeGen.Fable"
168+
137169
"Start"
138170
=?> ("BuildVersion", isAppVeyorBuild)
139171
==> "Restore"

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)