Scarlet is a custom compiler developed in C++, designed with the primary goal of enhancing our understanding of compiler construction. The overarching objective is to implement an exceptionally fast machine learning framework built atop this compiler.
To build Scarlet, invoke cmake
with the DCMAKE_CXX_COMPILER
flag within the build directory and then run make
. By default, scarlet builds in Release
mode (-O3).
cmake -DCMAKE_CXX_COMPILER=<compiler> -DCMAKE_BUILD_TYPE=<Release/Debug> ..
make
To test Scarlet, execute the following command within the build directory:
make test-scarlet
To execute our custom stress tests, execute the following command within the stress
directory:
./stress_test.sh
To check memory leaks in scarlet, run the following command within the stress
directory:
./check_memory_leaks.sh
Scarlet currently supports the following architectures:
Operating System | Compiler | Supported Architectures |
---|---|---|
Ubuntu | GCC | x86_64 |
Ubuntu | Clang | x86_64 |
macOS | Clang | ARM64 using Rosetta 2 |
- Implement a compiler driver with a custom lexer, parser, assembly generation pass, and code emission pass. (Note: We rely on GCC implementations for linking and preprocessing at this stage.)
- Integrate Boost Program Options to replace manual handling of
argc
andargv
functions. - (Lexer.cc) Find an alternative to erasing the
file_contents
text repeatedly. - (Parser.cc) Refactor every string to use enums.
- Create a static library for the lexer, parser, and code generation components.
- Add support for Unary Operations (Neg, Not)
- Add support for Binary Operations (Add, Sub, Mul, Div, Rem)
- Add support for Bitwise Binary Operations (And, Or, Xor, LeftShift, RightShift)
- Add support for logical and relational operators (! && || == != < > <= >=)
- Add support for user defined local variables
- Add support for if-else construct
- Add support for ternary operator
- Add support for increment/decrement operator
- Add support for compound operators (+=,-=,*=,/=,<<=,>>=,%=)
- Add support for goto statement
- Add support for compound statements
- Add support for Loops (for, while, do-while)
- Add support for switch-case
- Add support for Functions
- Add support for static keyword and global scope
- Add support for Long Integers
- Add support for Unsigned Integers
- Add support for Floating-Point Numbers
- Add support for Pointers
- Add support for Arrays
- Add support for characters and strings
- Add support for dynamic memory allocation
- Add support for user defined structures
We ask all contributors to adhere to the following guidelines:
- Please follow the Conventional Commits specification: Conventional Commits.
- Make your changes on a separate branch.
- Ensure that your Pull Requests (PRs) are atomic, addressing one change or feature at a time.