Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tr3sp4ss3rexe/compiler-miniJava

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miniJava Compiler

A minimal compiler for the miniJava language, built as part of a compiler design course. It features a full pipeline: lexical analysis, parsing, AST generation, semantic analysis, IR generation, control flow graph generation, and bytecode interpretation.

Compiler Flow

Features

  • Lexical Analysis using Flex
  • Parsing using Bison
  • AST construction
  • Semantic analysis with custom Symbol Table
  • Intermediate Representation (IR) generation
  • Control Flow Graph (CFG) output
  • Bytecode generation and interpretation

File Structure

  • lexer.flex: Lexical analyzer (tokens)
  • parser.yy: Parser (grammar rules)
  • Node.h: AST structure and DOT generator
  • symbolT.cc: Symbol table & semantic analysis
  • IR.cc: IR generation and CFG creation
  • interpreter.cc: Stack-based bytecode interpreter
  • main.cc: Compiler driver

Build

Compiling the compiler

make

Compiling the interpreter

make interpreter

Run

Running the compiler

./compiler <miniJavaFileName>

Running the interpreter - Interprets/Runs the bytecode file

./interpreter <output.class>

Developers

@me & https://github.com/FelixCenusa

About

A compiler and interpreter for a smaller variant of Java (miniJava)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published