Problem Statement: Build a basic Rust compiler using Lex and Yacc
The compiler performs the following tasks:
- Lexical Analysis
- Symbol Table Generation
- Syntax Analysis
- Semantic Analysis
- Error Detection
- Intermediate Code Generation
- Code Optimization
This project uses lex and yacc, and also requires gcc and python3 to be installed
sudo apt-get install -y flex byacc bisonOr use the Dockerfile instead to run the application in a container:
docker image build -t lex-yacc:latest .docker container run --name cdproject -it lex-yacc:latestcd phase\ 1Using make:
make parseOr compile each file individually:
flex parser.l
yacc parser.y
gcc y.tab.c -lfl -w
./a.out test.rscd phase\ 2To Generate ICG:
make parseOr compile each file individually:
flex parser-v2.l
yacc parser-v2.y
gcc y.tab.c -lfl -w
./a.out test.rsTo optimize ICG code:
make optimizeOr
python3 code_optimizer.py icg.txt- Naveen K Murthy - PES2201800051
- Siva Surya Babu - PES2201800475
- Roshan Daivajna - PES2201800372