This folder contains the skeleton of a parser along with the input and output types for each analysis given in the assignment. It also contain an example of a "calculator" program in F# that reads an arithmetic expression from the command line and print the result of evaluating such expression for initial testing.
F#/FsLexYacc
- Lexer.fsl: The lexer for arithmetic expressions
- Parser.fsp: The parser for arithmetic expressions
- Types.fs: Global types that are used in many analysis
- AST.fs: Types for AST of arithmetic expressions
- Program.fs: The entrypoint for the program
- Security.fs: File for the security analysis
- SignAnalysis.fs: File for the sign analysis
- ProgramVerification.fs: File for program verification
- Graph.fs: File for graphs
- Interpreter.fs: File for the interpreter
Building this project requires .NET 7.0. Installation
- Windows: Installation instructions for this, can be found here.
- macOS: Building on macOS requires the
dotnet-sdk
package. This can be installed using Homebrew and runningbrew install dotnet-sdk
- Linux: There are many ways to install on Linux, but a good starting point might be this.
To run the program do:
dotnet run
This should display a list of the available commands to run. Among these are the calculator, which is a good starting point.
To run the calculator do:
dotnet run calc "1 + 52 * 23"
When you get further, the analysis can be explored in the interactive tool. Run the program in dev/
folder matching you operating system.
# Windows
./dev/win.exe --open
# macOS
./dev/macos --open
# linux
./dev/linux --open
With the --open
flag this should open the tool at http://localhost:3000/
in your browser.
The tool knows how to compile your program by the instructions in run.toml
.
It is recommended to update the binaries in dev/
regularly. You do this by running the command below matching your platform, and following the instructions when prompted:
# Windows
./dev/win.exe --self-update
# macOS
./dev/macos --self-update
# linux
./dev/linux --self-update
Every time you push to git, the program is ready to be evaluated automatically by your teachers.
The results as they are produced, can be seen (at GitLab) in the result
branch.