
An awesome README template to jumpstart your projects!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
The TBD Compiler is a project aimed at developing a full-fledged compiler in C, focusing initially on handling variable declarations, function definitions, and basic arithmetic operations. This compiler generates x86-64 assembly code in AT&T syntax, adhering to the Windows Application Binary Interface (ABI).
Currently this works only on Windows, and GNU assembler 'as' and Linker ans Loader 'ld' is required to run the generated '.asm' files.
-
Clone this repo
git clone https://github.com/LowLevelLore/tbd.git
-
Change directory and make
cd tbd && make
Now the tbd (on Linux) or tbd.exe (on Windows) will be available in the build directory.
To compile any file written in "tbd" language, following steps need to be followed. Assuming tbd/tbd.exe is available in PATH.
- Compiling
tbd -o <asm_file> <input_path> -v -f x86_64-mswin
- Assembling (On Windows)
as --64 -o <obj_file> <asm_file>
- Linking and Loading (On Windows) NOTE: Linking to lmsvcrt is necessary
ld -o <exe_file> -subsys=console <obj_file> -L <path_to_lmscvrt.a> -lmsvcrt -e _start
- Running (On Windows)
./<exe_file>
- Get Started
- Variable definition and assignments
- Parsing
- Codegen
- Function definition and calls
- Parsing
- Codegen
- Lambdas
- Parsing
- Codegen
- Conditionals
- Parsing
- Codegen
TODO: Binary operators dont work well with function calls, check that
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!