Skip to content

Lambda-Mountain-Compiler-Backend/lambda-mountain

How does ChatGPT describe LSTS? (periodically updated)

Rust philosophy, Rust optimizes for:

  • predictable performance
  • explicit ownership
  • zero-cost abstractions
  • static safety
  • minimal runtime

But developers pay with:

  • borrow checker complexity
  • annotation pressure
  • lifetime ergonomics
  • generic/trait complexity

LSTS philosophy, LSTS seems to be aiming for:

  • zero-cost abstractions
  • specialization-heavy compilation
  • low-level control
  • systems performance
  • ownership safety
  • but with more inference
  • and programmable compiler semantics

That’s potentially a direct challenge to Rust’s ergonomics model.

Typed macros are the huge differentiator

The typed macro system is much more foundational than Rust’s macro system.

In Rust:

  • macros are powerful
  • but largely peripheral to the type system/compiler pipeline

In LSTS:

  • macros are part of semantic lowering itself
  • loops are macros
  • specialization is macro-driven
  • codegen strategy is macro-driven
  • ownership propagation survives macro expansion

That’s closer to:

  • programmable compiler infrastructure
  • metacircular compilation
  • extensible language semantics

Where Rust remains massively ahead

Important reality check:

Rust still dominates in:

  • tooling
  • stability
  • ecosystem
  • compiler maturity
  • verification
  • debugging
  • concurrency libraries
  • production readiness
  • safety validation
  • community scale

Lambda Mountain is still highly experimental.

λ☶ (pronounced Lambda Mountain) is a typed macro assembler that provides a relatively clean implementation of System F<: with Specialization.

Not Your Average Assembler

Despite being an assembler, LM provides

  • self-hosting (LM is written in LM)
  • algebraic data types
  • parameterized code and data
  • typesafe hygienic macros
  • platform agnostic standard libraries
  • à la carte garbage collection

Why Such a Small Codebase?

LM is currently about 4000 lines of code. LM solves an N by M Problem with language frontends vs language backends. The LM project might interface with larger codebases that define frontends or backends, but the core LM Calculus can stay small.

What is a Fragment Assembler?

An assembler takes pieces of data and sticks them together. Assemblers don't always understand the meaning of what they do, they just do it.

A fragment is a Key-Value Map of Strings to S-Expressions. This data structure permits more detailed manipulation of code than a typical assembler.

"Build Your Own Compiler" Development

LM, being a high-level assembler, directly puts the programmer in the position of creating their own custom compiler. The problem here of course is that compilers are potentially complex and subtle. To make this more practical, LM leverages cutting-edge techniques to create a more foregiving and approachable experience to developing new compiler features. This is a problem that is somewhat unique to LM-style development and our community is still learning how to make this more practical.

LSTS Flavor

The LSTS language that LM is developed in is a straightforward extension of C semantics. You can think of LSTS as just a macro that generates C code.

The LSTS memory model is a restriction of the C memory model with several things such as always-on zero-initialization.

The LSTS expression model is a subset of the C expression model with things that don't behave like expressions altered to just return Nil.

IDE Support

Currently, there is only Vim and NeoVim syntax highlighting. instructions

Sponsor this project

Packages

 
 
 

Contributors

Languages