This project implements a simple compiler that translates a subset of Java code into x86 assembly code. The project is built using Lex (Flex) for lexical analysis, Yacc (Bison) for parsing, and Python for intermediate code generation and final assembly code generation.
lexer.l: Lexical analyzer definition file.parser.y: Syntax analyzer definition file using Yacc.symbol_table.py: Python script managing the symbol table.tac_generator.py: Python script for generating three-address code (TAC).x86_generator.py: Python script for converting TAC to x86 assembly code.main.py: Main script to run the entire compilation process.Makefile: Build automation script.README.md: Project documentation.
- Build the Compiler:
make Compile a Java Program:
Place your Java code in an input.java file. Run the compiler:
python3 main.py