This project implements a compiler for the Java-- programming language, a subset of Java with additional features. Developed for the Compilers course (L.EIC026) at the University of Porto.
The compiler processes Java-- source code through these stages:
-
Frontend
- Lexical & syntactic analysis (ANTLR-based)
- Semantic analysis with symbol table generation
-
Intermediate Representation
- OLLIR code generation
- Optimizations:
- Constant propagation/folding
- Configurable register allocation
-
Backend
- Jasmin bytecode generation
- JVM-specific optimizations
- Full Java-- grammar implementation
- Varargs method parameters
- Array operations and initializers
[1,2,3]
- Control structures (if-else, while)
- Type checking and semantic validation
Option | Description |
---|---|
-o |
Enable all optimizations |
--r=N |
Register allocation strategy: • N≥1 : Max N registers• 0 : Minimal registers• -1 : No allocation (default) |
java -jar compiler.jar [options] input.jmm