This Mini Compiler implements a Level 3 grammar (Simple C3) - it parses and executes programs with variables, functions, expressions, control flow, and basic input/output.
Statements and control flow:
-
Variable declaration and assignment
-
Function declaration and calls with parameters and return values
-
if / else conditionals
-
while loops, including break and continue
-
printf and scanf for console I/O
Expressions and operators:
-
Arithmetic: +, -, *, /, %
-
Assignment: =, +=, -=, *=, /=, %=
-
Unary: - (negate), ++, -- (prefix and postfix)
-
Logical: &&, ||, !
-
Bitwise: &, |, ~
-
Comparison: <, <=, ==, !=, >=, >
The project includes demo programs demonstrating variable handling, loops, conditionals, function calls, and I/O. Automated test cases verify that all language features work as expected.
- To test the demo functions, just run the main class, and it will automatically compile and run them.
- To run the test cases, just run the SimpleC1TestRunner or SimpleC3TestRunner class, and it will execute all the test cases and report any failures.