Compiler from a subset of C to MIPS in OCaml
tests | ||
.gitignore | ||
.merlin | ||
ast.ml | ||
baselib.ml | ||
build.sh | ||
compiler.ml | ||
lexer.mll | ||
mips.ml | ||
parser.mly | ||
README.md | ||
semantics.ml | ||
simplifier.ml | ||
t.s | ||
test.ml |
MiniC
Fonctionnalités
- Declaration des types de bases (int, char, float, bool)
- Declaration des fonctions
- Conditions if, else, else if
- Boucle while
- Fonctions natives :
_add
_sub
_mul
_div
_add
_sub
_mul
_div
_xor
_or
_and
_seq
_sne
_sge
_sgt
_sle
_slt
_mod
_neg
_not
puts
puti
geti
Tests
Test game (not really)
$ ocamlbuild -use-menhir test.byte
$ ./test.byte tests/game.test > t.s
$ spim t.s
(spim) load "t.s"
(spim) run
Autres tests (sans user input)
$ ./build.sh newt
$ ./build.sh puiss