LensorCompilerCollection icon indicating copy to clipboard operation
LensorCompilerCollection copied to clipboard

A compiler we made just for fun :^)

#+created: <2022-08-01 Mon>

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

** What LCC /Isn't/

LCC is not:

  • your system's linker
  • associated with LLVM

** Implemented Languages

  • Glint

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, by default, uses file extension to determine which language to treat the source as. ~lcc examples/glint/SimpleFile.g~ will treat the contents as ~Glint~ source, while ~lcc tst/ir/roundtrip.lcc~ will treat the contents as LCC's Intermediate Representation, for example . You can use ~-x LANG~ to treat source files as a particular language, regardless of extension.

** Building

Dependencies:

  • [[https://cmake.org/][CMake >= 3.20]]

  • Any C++ Compiler (We like [[https://gcc.gnu.org/][GCC]])

NOTE: If on Windows and using Visual Studio, see [[file:docs/VISUAL_STUDIO.org][this document]] instead.

First, generate a build tree using CMake. #+begin_src shell cmake -B bld #+end_src

Finally, build an executable from the build tree. #+begin_src shell cmake --build bld #+end_src