This folder contains the skeleton of a parser along with the input and output types for each analysis given in the assignment. It also contains 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 entry point 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. For installation, follow the description matching your platform:
- Windows: Installation instructions for this, can be found here.
- macOS: Building on macOS requires the
dotnet-sdkpackage. 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 check that you have an up-to-date version run dotnet --version to display the version number, which should be something starting with 7. If it does not, consider updating your installation, and if that doesn't work, try uninstalling your current version and installing from scratch.
The next step is getting the code, which is done by cloning this repository and using cd to change directory to the newly cloned folder. To do this, make sure that you have your SSH keys set up correctly (instructions for GitLab).
To run the program, navigate to the directory of your cloned repository and do:
dotnet runThis 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 the dev/ folder matching your operating system.
# Windows
./dev/win.exe --open
# macOS
./dev/macos --open
# linux
./dev/linux --openWith 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-updateEvery time you push your Git repository, your code is ready to be evaluated automatically by your teachers.
When your project has been evaluated, the results can be seen (at GitLab) in the "result" branch.