This is small compiler for a little set of C
You have to install Java JRE on your computer, the version must be newest than 10
- Download the .jar file from the release
- In Linux make it executable by:
chmod +x Mini_ANTLR.jar- Execute it by double-clicking it, or in alternative you can use:
java -jar MiniC_ANTLR.jarThe interface is divided in two parts:
- Input area -> where you can write your code
- Console -> where the program prints the output
First you have to write some code in the input area or open a file with your code via File menu, after that through the Command menu you can choose :
- Check input -> checks token and grammar
- Start evaluation -> after a check, evaluates your code
- Debug -> after a check, evaluates your code and shows how the memory changes during execution
- Print parse tree -> prints the parse tree
- Stop -> stops all running actions
You can use one command at time
The output is written to the Console
The status led indicate if an action is running
You can save your input and your output in a file via the File menu
With Help menu you can read some info about this project, or you can open this page by clicking help
Checks all the input and controls if there are some wrong tokens or if the grammar is not respected Prints all the errors in the console; if there's no errors it prints "ready for evaluation..."
First checks the code, if the check is correct evaluates the code, otherwise prints all the parser and lexer errors. If errors are found during the evaluation, the evaluation stops and prints the errors to the console.
The behaviour is the same of "Start evaluation", but in this case, every time the memory changes, prints the memory state in this format:
after evaluation of: <statement that changes the memory>
undefined var:
level n: {<undefined variable at this level>}
level n+1: {<…>}
……………
memory :
level n: {<inizialized variable at this level>}
level n+1: {<…>}
……………level matches the blocks ({}), more details about the memory inside the docs
First checks the code, if the check is correct prints the parse tree, otherwise prints all the parser and lexer error.
This command stops all the running actions. It can be useful when there are semantic errors in the code; such as an infinite loop
- int
- double
- bool (true,false) -> are respectively 1 and 0
- '*' -> Times
- '/' -> Divide
- '%' -> Module
- '+' -> Plus
- '-' -> Minus
- '<' -> Less than
- '<=' ->Less equal than
- '>' -> Greater than
- '>=' -> Greater equal then
- '==' -> Equal
- '!=' -> Not equal
- '||' -> Or
- '&&' -> And
- '!' -> Not
- '=' -> Assignment
- if-else
- while
- block ({})
- printf -> only for int and double types, you can insert also boolean value that will be cast to integer, you can only use %d and %f format
- scanf -> only for int and double types, you can insert also boolean value that will be cast to integer, you can only use %d and %f format
Open a issue or open a pull request





