This is a compiler and interpreter for the Fasto programming language. The source code resides in the Fasto directory.
For a detailed overview of changes and additions, check the commit history: Commit History.
- .NET 8.0 SDK (not a Mono-based F#, ensure the
dotnetexecutable is in your search path). bashfor executing various test scripts in the/binfolder.- Java Runtime Environment (JRE) to run the RARS simulator for RISC-V assembly.
To build the compiler, run:
make
or
dotnet build Fasto
- Interpret, compile, or optimize a Fasto program:
bin/fasto.sh - Execute a compiled program (in RISC-V assembly):
bin/rars.sh - Compile and immediately execute a Fasto program:
bin/compilerun.sh
To run all tests from the tests directory (or another specified directory), use:
bin/runtests.sh
Options:
-ito run in interpreted mode-oto enable optimizations in the compiler
You can show the result of the optimizations with:
fasto.sh -p OPTS foo.fowhereOPTSis a list of optimization passes, e.g., ic for just inlining and copy/constant propagation.
Ex. ./bin/fasto.sh -p ic tests/copyConstPropFold2.fo
For a detailed view over the OPTS:
let extractOpt (op : opt) =
match op with
| 'i' -> Some inlineOptimiseProgram
| 'c' -> Some optimiseProgram
| 'd' -> Some removeDeadBindings
| 'D' -> Some removeDeadFunctionwhere i and c was just explained, and the rest is pretty selfexplanatory.
match paramList with
| [|"-i"; file|] -> interpret (sanitiseFilename file)
| [|"-r"; file|] -> let res = interpretSimple (sanitiseFilename file)
printfn "\n\nResult of 'main': %s\n" (AbSyn.ppVal 0 res)
| [|"-c"; file|] -> compile (sanitiseFilename file) (fun x -> x)
| [|"-o"; file|] -> compile (sanitiseFilename file) defaultOptimisations
| [|"-o"; opts; file|] ->
match extractOpts (explode opts) with
| Some (opts') -> compile (sanitiseFilename file) opts'
| None -> bad ()
| [|"-P"; file|] ->
printOptimised (sanitiseFilename file) withoutOptimisations
| [|"-p"; file|] ->
printOptimised (sanitiseFilename file) defaultOptimisations
| [|"-p"; opts; file|] ->
match extractOpts (explode opts) with
| Some (opts') -> printOptimised (sanitiseFilename file) opts'
| None -> bad ()
| _ -> bad ()Here is a detailed view over all params you can use for the fasto.sh file!
For more details and updates, check the commit history: Commit History