Skip to content

LowLevelLore/tbd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Best-README-Template

An awesome README template to jumpstart your projects!
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

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

(back to top)

Getting Started

Currently this works only on Windows, and GNU assembler 'as' and Linker ans Loader 'ld' is required to run the generated '.asm' files.

  1. Clone this repo

    git clone https://github.com/LowLevelLore/tbd.git
  2. Change directory and make

    cd tbd && make

Now the tbd (on Linux) or tbd.exe (on Windows) will be available in the build directory.

Usage

To compile any file written in "tbd" language, following steps need to be followed. Assuming tbd/tbd.exe is available in PATH.

  1. Compiling
    tbd -o <asm_file> <input_path> -v -f x86_64-mswin
  1. Assembling (On Windows)
    as --64 -o <obj_file> <asm_file> 
  1. 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
  1. Running (On Windows)
    ./<exe_file>

(back to top)

Roadmap

  • 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

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Acknowledgments

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!

(back to top)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published