UniC is a C compiler frontend implemented in Python, comprising a Lexer, Parser, Semantic Analyzer, and Symbol Table Manager.
This project was developed as part of the Compiler Design lab sessional during my BTech IT undergraduate course. UniC aims to provide a basic C compiler frontend, demonstrating the fundamental concepts of compiler design.
- Lexer: Tokenizes C source code into lexical units
- Parser: Parses tokens into an Abstract Syntax Tree (AST)
- Semantic Analyzer: Performs semantic checks on the AST
- Symbol Table Manager: Manages symbol tables for identifier storage
- Programming Language: Python
- Libraries : anytree
- Compiler Components: Lexer, Parser, Semantic Analyzer, Symbol Table Manager
- DFA : We designed the following DFA to implement the lexer.
To explore UniC, follow these steps:
- Clone the repository:
git clone https://github.com/SatyaSP/UniC.git
- Navigate to the project directory:
cd UniC
- Activate the
unic_venv
virtual environment. - Run the compiler frontend using Python:
python unic.py
If you are on windows you can also use unic.cmd
or unic.ps1
to directly run commands on command prompt or powershell to provide the C file path. (.\unic <path/to/c/file.c>
). Alternatively you can add this directory to you environment path variables list to use this command globally in your terminal.