Lesma is a compiled, statically typed, imperative, and object-oriented programming language with a focus on expressiveness, elegance, and simplicity without sacrificing performance.
- π Fast Compilation: compiling at a rate of β230k loc/s, because waiting for code to compile is a thing of the past
- β‘ Blazing Fast Execution: because it should be, it's as fast as C, using LLVM's state-of-the-art optimizations, but it won't ever oblige you to make an extra effort just for the sake of performance
- π¬ Statically Typed: because IDE completion is like heaven, while unknown behaviour and runtime exceptions are like hell
- π§βπ¨ Simple: because the code should be easily readable, and it shouldn't make you guess what it does or take long to learn
- Official Documentation
- Examples
- In-repo docs source:
tools/docs/content/docs/(e.g. language/types.mdx)
Every Lesma release contains archives with the binary and standard library which you can grab. Alternatively, you can use the installer script to do all the work for you. The get-lesma.sh script downloads and installs the latest release.
Run the following in your terminal:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/alinalihassan/Lesma/main/scripts/get-lesma.sh)"In order to build Lesma, you need a C++23 compiler, LLVM (21 recommended; see AGENTS.md), lld, and Ninja installed. We recommend using Clang as the host C++ compiler. It's currently only supported on Linux and macOS.
For a more comprehensive guide, and more information on how to install the prerequisites,
read the documentation on Getting Started
Required:
- CMake 3.24+
- Ninja
- C++23 compiler (Clang recommended)
- LLVM 21 (recommended; same generation as linked libraries)
- lld
vcpkg is included as a git submodule for dependency management. After cloning Lesma, init and bootstrap it:
git submodule update --init --recursive
cd vcpkg
./bootstrap-vcpkg.sh # On Linux/macOS
cd ..brew install llvm lld
export LLVM_DIR=$(brew --prefix llvm)/lib/cmake/llvm# Ubuntu/Debian
sudo apt-get install llvm-dev lld clang
# Or for a specific version (e.g., LLVM 17)
sudo apt-get install llvm-17-dev lld-17 clang-17This option builds LLVM from source using vcpkg. It takes significant time (~1-2 hours) but works on any platform.
# Configure with LLVM build enabled
cmake . -Bbuild -DLESMA_BUILD_LLVM=ON -G Ninja
cmake --build build-
Clone the repository and init the vcpkg submodule
git clone --recurse-submodules https://github.com/alinalihassan/Lesma cd LesmaIf you already cloned without
--recurse-submodules, rungit submodule update --init --recursiveand bootstrap vcpkg (see above). -
Run CMake to configure and build
# Using presets (recommended) cmake --preset Debug cmake --build --preset Debug # Or manually cmake . -Bbuild -DCMAKE_TOOLCHAIN_FILE="$(pwd)/vcpkg/scripts/buildsystems/vcpkg.cmake" -G Ninja cmake --build build
-
Run tests (optional)
cd build/Debug # or build/Release ctest --output-on-failure
Enable LESMA_BUILD_BENCHMARKS in CMake, build the benchmark target, then from the repository root run the integration wall-clock harness (it spawns lesma run per test and writes JSON plus an optional Vega-Lite chart spec):
./build/Debug/benchmark suite ./build/Debug/lesma \
--vega-lite-out suite.vl.json \
--json-out bench.jsonTimings in bench.json are in milliseconds (milliseconds per test; total_wall_milliseconds / mean_milliseconds_per_test in aggregate). Render a static SVG with Vega-Liteβs CLI (no native canvas required); redirect stdout so the SVG is not printed in the terminal:
npx -p vega-lite vl2svg suite.vl.json > chart.svgSee AGENTS.md for flags (--suite, --opt, GitHub Actions JSON, and PNG options).
Pull requests are welcome. For major changes, please open an issue to discuss your proposal and what you'd like to change.
Repository tooling lives under tools/:
-
tools/docscontains the Fumadocs (Vite + React Router) documentation site, including the in-app playground at/playground, and is built into the unified container image. -
tools/playgroundincludeswrangler.jsonc+worker.ts+Dockerfilefor Cloudflare Workers + Containers: one image serves the combined docs SPA at/(playground route included) and the compiler API at/api. -
tools/vscodecontains the VS Code extension that launches the nativelesma-lspserver. -
To keep updated with releases, consider starring the project.
-
Check the code of conduct and contributing guidelines
This software is licensed under the MIT Β© Alin Ali Hassan.