-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# comp2mzam | ||
Imperative language compilation to the Mini-ZAM | ||
# comp2mzam - Imperative language compiler to the Mini-ZAM | ||
|
||
Here is a compiler producing bytecode for a simplified implementation of the OCaml Virtual Machine, called Mini-ZAM. | ||
|
||
*This project is part of the Advanced Compilation course of my professional training.* | ||
|
||
## Technical stack / choices | ||
|
||
I made the choice of OCaml ecosystem for the compiler implementation : | ||
|
||
* [OCaml V4.13.1](https://ocaml.org) | ||
* [OCamlLex standard component for lexical analysis](https://ocaml.org/manual/lexyacc.html) | ||
* [Menhir 20211230 tool for syntax analysis](https://gitlab.inria.fr/fpottier/menhir) | ||
* Use [OPAM 2.1.1 Ocaml PAckage Manager](https://opam.ocaml.org/packages/menhir) for Menhir installation | ||
|
||
## Compilation and execution | ||
|
||
To compile the project source code, run the default Makefile command | ||
|
||
```console | ||
make | ||
``` | ||
|
||
To execute the project (bytecode generation for the Mini-ZAM), run this command.\ | ||
In the following example, tests/t0.txt file is compiled to tests/build/bc_t0.txt file.\ | ||
To get an idea of the result, see the bytecode sample file tests/build/demo-bytecode.txt | ||
|
||
```console | ||
S=t0.txt make compile | ||
``` | ||
|
||
Then, you need a Mini-ZAM to interpret the generated bytecode. |