Skip to content

A toy compiler handwritten in a weird subset of C++

License

Notifications You must be signed in to change notification settings

yaram/simple-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Compiler

A toy compiler handwritten in a weird subset of C++.

The language is a staticly typed, low-level systems programming language. It is compiled to an internal IR, then LLVM is used to generate native machine code.

The compiler currently requires clang for compiling the runtime/bootstrap code and lld for linking.

The compiler also includes a profiler (for the compiler itself) that can be enabled with the -DPROFILING=Yes option given to CMake. The profiler trace logs are viewable with speedscope. The profiler currently only works on Windows and x86.

Building

  1. Install LLVM 11 or higher (including clang and lld)
  2. Install CMake 3.21 or higher
  3. Install target development depndencies
    • (Windows) Install the Windows SDK (Only tested on Windows 10)
    • (Linux) No development libraries are needed
    • (Emscripten) Install the Emscripten SDK
  4. Clone repository
    git clone https://github.com/yaram/simple-compiler.git
    cd simple-compiler
  5. Run CMake configuration
    mkdir build
    cd build
    
    cmake ..
  6. Run build
    cmake --build . --target compiler

About

A toy compiler handwritten in a weird subset of C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published