A compiler for the Flit programming language.
- Lexical Analysis: Breaks down Flit code into meaningful tokens (keywords, identifiers, numbers, etc.).
- Syntax Analysis: Constructs an Abstract Syntax Tree (AST) representing the structure of Flit programs.
- Code Generation: Translates the AST into x86-64 assembly code.
- Memory Allocator: Allocates memory linearly in previous reserved chunk
- Project Workflow: Tokenize => Parse => Generate Assembly Code
- Operator Precedence: PEMDAS precedence for arithmetic operations implemented.
Prerequisites
- NASM (Assembler)
- LD (Linker)
- A suitable operating system (Linux for now)
Steps
-
Clone this repository:
git clone https://github.com/Meet7834/Flit.git
-
Navigate to directory:
cd flit
-
Compile the Flit program:
mkdir build cmake -S . -B build cmake --build build
-
Execute the program with:
./build/flit ./my_program.flt
- For Sample code see grammar.md or see allFeatures.flt or test.flt
Contributions are welcome! Feel free to open issues or submit pull requests.
- Add tests
- Add Comparison Operators (==, <, >, etc...)
- Introduce Functions
- Introduce more data types.