Skip to content

LensPlaysGames/LensorCompilerCollection

Repository files navigation

Lensor Compiler Collection

Now written in C++, LCC started as a compiler written in C for just one hobby language, Intercept. Over the course of a few years, it has grown into a compiler collection, with a whole host of frontends created and maintained by the growing and thriving community.

Implemented Languages

  • Intercept (WIP)
  • Laye (WIP)

In the future, we hope to support

  • some of C
  • YOUR language :)

Usage

For convenience purposes, there is a single executable, lcc, that can delegate between all of the different compilers in the collection. This is called the compiler driver, often shortened to just driver.

Running the driver executable with no arguments will display a usage message that contains compiler flags and options as well as command layout.

The driver uses file extension to determine which compiler to pass the source code to. lcc ./tst/intercept/byte.int will invoke the Intercept compiler, while lcc ./tst/laye/exit_code.laye will invoke the Laye compiler, for example.

Building

Dependencies:

NOTE: If on Windows and using Visual Studio, see this document instead.

First, generate a build tree using CMake.

cmake -B bld

Finally, build an executable from the build tree.

cmake --build bld

To build generated .s x86_64 ASM

To use external calls, link with appropriate libraries!

GNU Binutils:

as code.S -o code.o
ld code.o -o code

GNU Compiler Collection

gcc code.S -o code

LLVM/Clang

clang code.S -o code --target=x86_64

To build generated .ll LLVM

Use LLVM’s clang to compile the generated LLVM output into a library or executable.

clang code.ll -o code