Skip to content

CarlosSanchess/Java--Compiler

Repository files navigation

Java-- Compiler

Overview

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.

Compiler Pipeline

The compiler processes Java-- source code through these stages:

  1. Frontend

    • Lexical & syntactic analysis (ANTLR-based)
    • Semantic analysis with symbol table generation
  2. Intermediate Representation

    • OLLIR code generation
    • Optimizations:
      • Constant propagation/folding
      • Configurable register allocation
  3. Backend

    • Jasmin bytecode generation
    • JVM-specific optimizations

Key Features

Language Support

  • Full Java-- grammar implementation
  • Varargs method parameters
  • Array operations and initializers [1,2,3]
  • Control structures (if-else, while)
  • Type checking and semantic validation

Optimization Flags

Option Description
-o Enable all optimizations
--r=N Register allocation strategy:
N≥1: Max N registers
0: Minimal registers
-1: No allocation (default)

Usage

java -jar compiler.jar [options] input.jmm

About

This project consists in developing a compiler for Java--, a simplified subset of the Java language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •