Prysma Programming Language
Prysma is a system programming language compiled to the LLVM 18 infrastructure. The project focuses on deterministic resource control without a garbage collector, branchless compile-time lookup tables for tokenization, contiguous arena allocation, and parallel multi-file compilation.
Technical Capabilities
- LLVM Backend: Intermediate Representation (IR) generation targeting LLVM 18 SSA form using opaque pointers.
- Lexical Analysis: Tokenization powered by compile-time lookup tables (256-byte CharClass LUT) and Little-Endian 64-bit integer comparisons, eliminating dynamic hashing overhead.
- Memory Management: Manual heap allocation via
newanddeleteoperators. AST node allocations backed by contiguous arenas (llvm::BumpPtrAllocator). - Multi-file Compilation: Parallel 2-pass compilation pipeline using
llvm::ThreadPool, resolvingincludedirectives with circular dependency detection. - Object Model: Classes with
public:,private:, andprotected:access specifiers, single inheritance, and dynamic polymorphism via virtual method tables (vtables). - Static Analysis: Strict typing system with safe auto-casting, context stacks for lexical scopes, and fail-fast early syntax error detection.
Compiler Architecture
The compiler operates across a modular pipeline:
- Frontend: Branchless lexical tokenization (
Lexer::tokenize) and recursive descent instruction parsing. - Pass 1 (Analysis & Registration): AST construction and declaration registration via
FillingVisitorRegistryandFillingVisitorBodyClass. - Pass 2 (Environments & Emission): Symbol table resolution (
BuilderEnvironmentRegistryFunction,BuilderEnvironmentRegistryVariable) and LLVM IR emission viaGeneralVisitorGenCode. - Backend: Optimizations and native binary generation by the LLVM infrastructure.
Syntax
fn int32 main() {
dec string message = "Prysma system operational";
call print(ref message);
return 0;
}
Compilation with Docker
The official compilation toolchain (LLVM 18, Clang 18, LLD, CMake, ccache, Python) is encapsulated within a Docker container to ensure reproducible builds.
Docker Installation
| Host OS | Installation Guide |
|---|---|
| Arch Linux | Arch Linux Guide |
| Debian | Debian Guide |
| Ubuntu | Ubuntu Guide |
| Windows (PowerShell) | Windows Guide |
Quick Start
Build the compilation image:
docker build --target debug -t prysma-debug -f docker/compiler/Dockerfile .Compile the project from the host:
# Release mode (-O3, -march=native, -flto, lld) docker run --rm -v "$(pwd)":/workspace prysma-debug python3 build.py # Instrumented Debug mode (-g3, -O0, ASan, UBSan) docker run --rm -v "$(pwd)":/workspace prysma-debug python3 debug.pyInteractive session:
docker run --rm -it -v "$(pwd)":/workspace prysma-debug
The build.py / debug.py script automatically runs internal AST node, visitor, and parser generators before calling CMake and Clang.
VS Code Integration
The provided .vscode configuration interfaces directly with the container:
- Compilation (
Ctrl+Shift+B): Compiles the active.psource file viadocker/environnement_dev/linux/docker-cli.sh(ordocker/environnement_dev/windows/docker-cli.ps1on Windows). - Debugging (
F5): Debugger launch profiles for LLDB (C++ compiler, port 1234) and debugpy (Python generators, port 5678). - Clangd Code Intelligence: C++ code navigation and completion on the host without local LLVM dependencies.
- Syntax Highlighting: Extension in
.vscode/SyntaxeCouleurPrysmafor.pfiles.
See the VS Code Environment Guide. For advanced options and benchmarks, see the Docker Compilation Guide.
Documentation
Technical documentation is available in docs/:
- Compilation & Environment:
- Architecture & Design:
License
This project is distributed under the GPL v3 license. Consult the LICENSE file for legal details.