Home /Modules/compiler/MULTI-LANGUAGE.FRAMEWORK.md

MULTI-LANGUAGE.FRAMEWORK.md

lib/compiler/MULTI-LANGUAGE.FRAMEWORK.md · 142 line(s) · markdown

<p align="center"><img src="https://github.com/mearvk/SLeeLa/blob/master/images/sleela/sleela-compiler-logo-001.jpeg" alt="SLeeLa Compiler" width="100%"></p>

SLeeLa Multi-Language Compiler Framework

Max Rupplin - MEARVK LLC - 2026

The /lib/compiler package provides a modular framework for building compilers for any publicly known programming language. A developer adds a new language by writing one small SLeeLa front end that extends a common contract; many independent front ends live side by side and are registered into one shared catalog. No per-language allow-list is baked into the compiler.

Authority

Every language front end lowers its own language toward the common SLeeLa IR and, from there, a VM-ready artifact. The authoritative path is unchanged:

<language> source  ->  <language> front end  ->  SLeeLa IR  ->  VM lowering  ->  SLVM/SLJVM

The framework does not create a parallel language, and it does not grant itself VM, capability, security, resolver, memory, or certificate authority. A produced artifact is only ever executed later across an explicit SLeeLa VM/OS and security boundary. Compilation is not execution.

The contract

A compiler for a language is an SLLanguageCompiler subclass. The base type (SLLanguageCompiler.sleela) defines:

Canonical pipeline phases

#PhaseRole
1sourceload/normalize source units
2lextokenize
3parsebuild the language syntax tree
4resolvenames, scopes, imports, symbols
5semantictypes, capabilities, dependencies
6irlower to target-neutral SLeeLa IR
7lowerlower IR to VM-ready operations
8codegenemit artifact

Targets

TargetMeaning
SLVMSLeeLa VM artifact (authoritative native path)
SLJVMSLeeLa JVM-family artifact (used by JVM-family languages)
SLIRstop at SLeeLa IR (library/analysis, no emission)
NATIVEnative plan only; emission remains gated by the VM/OS boundary

Phases 1–6 (source..IR) are the common minimum for any produced model; SLVM, SLJVM, and NATIVE additionally require lower and codegen.

Supporting types

Modular front ends

Each language is an independent unit under frontends/<language>/. The shipped examples span native, JVM, and scripting families to show the pattern:

Front endFileFamilyDefault target
Cfrontends/c/CLanguageCompiler.sleelaC-familySLVM
C++frontends/cpp/CppLanguageCompiler.sleelaC-familySLVM
Javafrontends/java/JavaLanguageCompiler.sleelaJVMSLJVM
Pythonfrontends/python/PythonLanguageCompiler.sleelascriptingSLVM
JavaScriptfrontends/javascript/JavaScriptLanguageCompiler.sleelascriptingSLVM
Rustfrontends/rust/RustLanguageCompiler.sleelasystemsSLVM
Gofrontends/go/GoLanguageCompiler.sleelasystemsSLVM

These are reference front ends that declare identity and the full pipeline, with phase hooks annotated for the language-specific behavior a developer plugs in (e.g. Python's indentation-significant lexing, Rust's borrow analysis in the semantic phase, C++'s template/overload resolution). The LANGUAGE.FORMAT.REFERENCE.md catalog is the recognition data these front ends draw their identity from; it identifies, it never authorizes execution.

Adding a language

  1. Create frontends/<language>/<Name>LanguageCompiler.sleela.
  2. Extend SLLanguageCompiler; in configure() call declare(...) and provide(...) for each phase you implement.
  3. Override the phase hooks (runLex, runParse, ...) with the language's behavior.
  4. Register it: registry.add(new <Name>LanguageCompiler()).

The recursive /lib discovery used by the compiler and the Nordshrift loader picks up the new directory automatically — no compiler allow-list change.

Native boundary

C provides the stable ABI; C++ orchestrates. Neither bypasses the SLeeLa capability, security, resolver, memory, certificate, or VM boundaries.

FileRole
include/sleela_langc.hC ABI: module descriptor, registry, phase model, planning
src/sleela_langc.cC implementation (allocation-free, no I/O, no execution)
include/sleela_langc.hppC++ orchestration facade (LanguageCompiler, Registry, Plan)
src/sleela_langc.cppC++ TU + compile-time C/C++ congruence checks
include/sleela_lang_bridge.hnative VM/OS bridge entry points the .sleela layer calls
src/sleela_lang_bridge.cflat-scalar registration + integer plan-handle adapter
tests/langc_selftest.cbehavioral self-test with real assertions

Build and test

make -C lib/compiler native     # compile the C/C++ framework objects
make -C lib/compiler selftest   # build and run the behavioral self-test
make -C lib/compiler all        # native + selftest + runtime + inventory + sanity

The self-test checks registration/replacement, case-insensitive lookup, extension resolution, phase planning, and the fail-closed strict and reference-only paths.

SLeeLa — MEARVK LLC — 2026