MiniC Compiler built using LLVM and Antlr parse generator as a part of the Compilers course project at IIIT Hyderabad. MiniC is a minimalistic compiler inspired by the programming languages Python and C.
MiniC Compiler
|__ Language specifications manual - contains the details about Micro and Macro syntax and Semantics of MiniC.
|__ Parser - Parses MiniC expressions using Antlr Parse Generator which can be visualised in java GUI
|__ MiniC-Compiler - Complete compiler which includes Syntax Analyser, Expression Parser, AST Construction, Semantic checks, LLVM IR
|__ Sample programs written in MiniC can be found here
Refer to the antlr main website.You can find how to install on Linux, OS X, Windows.
PS: Make sure you put following lines in your source file(.bashrc, .zshrc etc.,)
export CLASSPATH=".:/usr/local/lib/antlr-4.8-complete.jar:$CLASSPATH"
alias antlr4='java -jar /usr/local/lib/antlr-4.8-complete.jar'
alias grun='java org.antlr.v4.gui.TestRig'
$ source ~/.bashrc
You can refer to Installation guide here.
To check if Java is installed:
$ java -version
$ javac -version
You can refer to Installation guide here.
$ cd parser
$ make
General command:
$ grun <name_of_grammar> <root_node/Start Symbol> <path_to_test_file> <option>
Command here:
$ grun Expr prog ../tests/<test_file> -gui
$ cd miniC-project
$ make
./expr <test-code>