Welcome to CodeForge, a minimal yet powerful compiler designed for a custom programming language. Built using Flex, Bison, and C.
CodeForge compiles a simplified source language and demonstrates key phases of compilation. It currently supports:
Lexical Analysis using Flex Parsing using Bison Semantic Analysis (type checking, symbol tables – WIP) Intermediate & Assembly Code Generation (planned in future weeks)
The goal is to incrementally build a fully functional compiler while learning core concepts of language design and translation.
*** Prerequisites ***- open your project folder in VS Code and use WSL (Ubuntu) terminal for running commands.
- Install : flex and bison
-
flex lexer.l
-
gcc lex.yy.c src/main_lexer.c -o lexer -lfl
-
./lexer test_input.txt
-
bison -d parser.y
-
flex lexer.l
-
gcc parser.tab.c lex.yy.c src/main.c -o compiler -lfl
-
./compiler test_input.txt
Contributions are welcome! To contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch (git checkout -b feature-branch-name).
- Make your changes.
- Commit your changes (git commit -m 'Add some feature').
- Push to the branch (git push origin feature-branch-name).
- Open a Pull Request.
For major changes, please open an issue first to discuss what you would like to change.