A compiler for the Mini-Java programming language.
Take a look at documentation/mjmanual.pdf to read
the manual and more details about the Mini-Java programming language.
mjc is the compiler implemented for the Mini-Java programming
language following the specifications present in the manual.
mjlexer is the lexical analyzer used by mjc to recognize the
Mini-Java tokens. It was generated by the lex tool.
You can test mjlexer by following the steps below:
- install
flex, to gather thelextool - run
$ make lexer - run either
echo "your code goes here" | ./bin/mjlexeror./bin/mjlexer < your-program.mj
LL(1) parsers apply left derivations from left to right
looking at most one token ahead in order to select the
proper production. mjc can be used with two LL(1) parsers,
a recursive and a non-recursive ones. You can run
each of those parsers by following these steps:
- run
$ make ll1parser - run
$ ./bin/mjcll1 [R | N] < your-program.mj, whereRindicates to use the recursive parser, andN, the non-recursive.
Yacc was used to generate a bottom-up parser for the Mini-Java Language. You can run it by following these steps:
- run `$ make lalrparserast
- run
$ ./bin/mjclalr < your-program.mj
This will print an Abstract Syntax Tree of the program.