Skip to content
/ Flit Public

Flit is a learning project. It's a compiler that translates Flit source code into x86-64 assembly language. It does lexical analysis, syntax analysis, code generation, and memory allocation.

Notifications You must be signed in to change notification settings

Meet7834/Flit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flit

A compiler for the Flit programming language.

Features

  • 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.

Usage Instructions

Prerequisites

  • NASM (Assembler)
  • LD (Linker)
  • A suitable operating system (Linux for now)

Steps

  1. Clone this repository:

    git clone https://github.com/Meet7834/Flit.git
  2. Navigate to directory:

    cd flit
  3. Compile the Flit program:

    mkdir build
    cmake -S . -B build
    cmake --build build 
  4. Execute the program with:

    ./build/flit ./my_program.flt

Example Flit Program

  • For Sample code see grammar.md or see allFeatures.flt or test.flt

Contributing:

Contributions are welcome! Feel free to open issues or submit pull requests.

Roadmap:

  • Add tests
  • Add Comparison Operators (==, <, >, etc...)
  • Introduce Functions
  • Introduce more data types.

About

Flit is a learning project. It's a compiler that translates Flit source code into x86-64 assembly language. It does lexical analysis, syntax analysis, code generation, and memory allocation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published