/laye

Compiler for the Laye programming language.

Primary LanguageCOtherNOASSERTION

Laye

A systems programming language that wears its love for C on its shoulder.

Philosophy

C is by no means perfect, nor is Laye trying to be perfect in its stead. Rather, Laye understands that C is here to stay for the foreseeable future, and wants to peacefully co-exist with established C code while supporting modern and (hopefully) sensible language features to the table. To achieve this, Laye allows seamless importing of C source files, most commonly the public headers, into any Laye source file. In addition, Laye provides lightweight FFI to expose its own functions and data types to C.

Requirements

  • Any standard compliant C17 compiler (we like Clang)
    • If your compiler does not support an address sanitizer with the -fsanitize=address option or you don't have one installed, see the build configuration options for the option to disable it.
  • Clang 18 specifically to compile the IR generated by the LLVM backend
  • CMake for running fchk tests (see testing)

NOTE: The build system currently inherits whatever compiler you use to build it. All of the examples here use Clang, so the the project will also be built with clang. If you want to build Laye with GCC instead, replace instances of clang with gcc and that will propogate.

Building

  1. Build Nob

    This project uses a version of the Nob build system by Tsoding included with this repository.

    $ clang -o nob nob.c
  2. Run Nob Nob will automatically rebuild itself if any changes are made to the build script.

    $ ./nob

    You can run ./nob --help to see all of the commands and configuration available to you, and ./nob <command> --help for help filtered specifically to that command. By default, the build subcommand is assumed.

Usage

$ ./out/laye1 [options...] files...

Run ./out/laye1 --help for a list of avaliable options.

Testing

The test suite is written for the fchk tool, which has a few additional dependencies as listed in requirements.

$ ./nob test

Tests are located in the ./test directory. Each test file is a source file which defines the test inline, as well as how it should be invoked by the tooling. Read the fchk documentation to understand how it works.

Editor Support

Laye has a Visual Studio Code extension for syntax hilighting. Find it here.

License

The source code of this repository is dual-licensed: either the MIT license or in the public domain. You can choose whichever suits you best. See the license file for the high level details on each. The license applies only to source files which contain a copy the license information within them; this means, for example, that the "Laye" name is not in the public domain, only the source files of this implementation of its compiler.

Contributing

See the documentation on contributing in the GitHub project wiki.