A compiler written in OCaml for Grinnell College's CSC 312 course with Peter-Michael Osera.
Halle Remash | halle@remash.com
- Download this repository into your directory
- Navigate to the
src
directory in this project in your terminal - Build the file using the
make
command
- Install OCaml
- Ensure that you have installed merlin
- If you used the OPAM package manager, type
opam search merlin
- Else see the merlin's README to install
- If you used the OPAM package manager, type
- Ensure that you have installed menhir
- If you used the OPAM package manager, type
opam install menhir
- If you used the OPAM package manager, type
- Install utop (about)
- If you used the OPAM package manager, type
opam install utop
- If you used the OPAM package manager, type
The Makefile for this project is located in the ./src
directory. Navigate there in order to run Makefile commands.
make
: build project using ocamlbuildmake clean
: runs ocamlbuild's cleanmake cleanup
: removes automatically generated filesmake test
: runs test.sh, the project test suitemake top
: runs utop (type#quit;;
to exit)
make
currently produces the file compiler.byte
which can be run in the terminal.
Note that this project compiles byte-code instead of native code.
Also note that ./compiler.byte
can be excecuted with -help
and -parse
flags in
addition to the .src
file that it "compiles".
When you wish to recompile the project (on Windows using Cygwin) type make cleanup
before typing make
.
e ::= n | (e) | e1 + e1 | e1 - e2 | e1 * e2 | e1 / e2
| true | false | e1 <= e2 | if e1 then e2 else e3
| x | let x = e1 in e2 | fun x -> e | e1 e2 | fix f x -> e