A statically-typed systems language with modern syntax that transpiles to C++
β ALPHA v0.8.19 - Stack Overflow Protection (BUG #300 fixed) β
Quick Start β’ Language Spec β’ Advanced Features β’ Design Patterns β’ Examples
L++ introduces the revolutionary autopattern keyword that intelligently generates complete implementations of all 23 Gang of Four design patterns!
// ONE LINE = COMPLETE PATTERN IMPLEMENTATION!
autopattern Singleton ConfigManager;
autopattern Factory ShapeFactory;
autopattern Observer EventBus;
β¨ Features:
- π― Intelligent Detection β Keyword-based pattern recognition
- π Zero Boilerplate β Complete pattern in one line
- π All 23 GoF Patterns β Creational, Structural, Behavioral
- π§ Smart Defaults β Pattern-specific methods and properties
- π‘ Type Safe β Full C++ type system integration
β See Complete Pattern Catalog
- π― Modern Syntax β Rust/JS-inspired (arrow functions, destructuring, spread)
- π¨ Multi-Paradigm β HYBRID, FUNCTIONAL, IMPERATIVE, OOP, GOLFED (5 paradigms!)
- π¦ ES6+ Support β Optional chaining (
?.), nullish coalescing (??), template literals - β‘ Golf-Style Operators β Symbolic functional programming (
~,@,?,\) - π Iterate-While β Haskell-inspired sequence generation (
!!<,!!>,!! $,~>) - π Paradigm Enforcement β Per-file paradigm declaration with validation
- π§ Pattern Matching β
matchexpressions with guards - π§© ADTs β Algebraic data types and type unions
- π¨ Higher-Order Functions β Map, filter, compose, pipeline operator
- π Interfaces & Traits β Protocol-oriented programming
- π List Comprehensions β Python-style syntax
- π Lambda Expressions β Closures with capture
- π Generators β
yieldkeyword for lazy evaluation - π Type Guards β
typeof,instanceofoperators - π Getters/Setters β Property accessors with
get/set - β¬
οΈ Arrow-Left Returns β Alternative return syntax (
<-)
- π‘οΈ Path-Sensitive Analysis β CFG + data-flow tracking
- β Paradigm Validation β Enforce functional purity, OOP, or imperative style
- π Division by Zero β Compile-time detection
β οΈ Uninitialized Variables β Catch bugs before runtime- π Dead Code Detection β Find unreachable code
- π« Null Dereference β Safety checks (45/45 critical bugs fixed β )
- π§ Memory Leak Detection β Track allocations
- π’ Integer Overflow β Warnings for potential overflows
- β Memory Safe Patterns β Smart pointers in all design patterns
- β Command Injection Prevention β Path validation & shell escaping
- β Bounds Checking β 80+ array access validations
- β NULL Safety β nullptr checks after dynamic_cast
- β Virtual Destructors β Prevent undefined behavior
- β Thread-Safe Singleton β std::call_once implementation
- π Path Finding β BFS-based path existence check
- π€οΈ Shortest Path β Unweighted graph traversal
- π Connected Components β Count graph components
- π¨ Bipartite Check β 2-colorability detection
- π§ VS Code Extension β Syntax highlighting + real-time errors
- π Problem Matcher β Errors shown directly in editor
- π Fast Compilation β Transpiles to C++ then native code
- β‘ High Performance β Optimized C++ output
- Quick Start Guide - Get started in 5 minutes
- Language Specification - Complete language reference
- Advanced Features - ES6+, golf operators, generators, quantum
- Design Patterns - 23 GoF patterns with autopattern
- Paradigms Guide - Multi-paradigm programming
- Bug Fixes History - All 45 bugs fixed in v0.8.17
- Changelog - Version history and releases
See docs/README.md for complete documentation with topic index.
lpp/
βββ src/ # Compiler source code
βββ include/ # Header files
βββ stdlib/ # Standard library
βββ examples/ # Sample programs
βββ tests/ # Test suite
βββ docs/ # π Complete documentation
β βββ QUICKSTART.md # Getting started
β βββ FULL_SPEC.md # Language reference
β βββ ADVANCED_FEATURES.md # Modern features
β βββ DESIGN_PATTERNS.md # Pattern catalog
β βββ PARADIGMS.md # Programming styles
β βββ BUG_FIXES.md # Bug fix history (45 bugs fixed)
β βββ README.md # Documentation index
βββ vscode-extension/ # VS Code integration
βββ CHANGELOG.md # Version history
βββ README.md # This file
Download a release or build from source:
git clone https://github.com/alb0084/lpp.git
cd lpp
cmake -B build
cmake --build build --config ReleaseCompiler output:
- Windows β
build/Release/lppc.exe - Unix β
build/lppc
Create hello.lpp:
fn main() -> int {
println("Hello, LPP!");
return 0;
}
Compile & run:
lppc hello.lpp
./hellolet x = 42; // immutable by default
let mut counter = 0; // mutable
counter = counter + 1;
let name: string = "LPP"; // explicit types
let pi: float = 3.14159;
fn add(a: int, b: int) -> int {
return a + b;
}
let multiply = (x, y) => x * y; // arrow functions
let squares = numbers.map(|n| n*n);
if (x > 0) {
println("positive");
} else if (x < 0) {
println("negative");
} else {
println("zero");
}
let result = x > 0 ? "positive" : "negative"; // ternary
// Golf-style operators (compact functional programming)
let range = 0~10; // [0,1,2,...,10]
let doubled = nums @ (x -> x * 2); // map
let evens = nums ? (x -> x % 2 == 0); // filter
let sum = nums \ ((acc,x) -> acc+x); // reduce
// Iterate-while (Haskell-inspired sequence generation)
let countdown = 10 !!> 0; // [10,9,8,7,6,5,4,3,2,1]
let powers = 1 !! (x -> x < 100) $ (x -> x*2); // [1,2,4,8,16,32,64]
let squares = 1 ~> (x -> x+1) !! (x -> x < 10) @ (x -> x*x); // [1,4,9,16,25,36,49,64,81]
// Destructuring & spread
let [a, b, ...rest] = array;
let {x, y} = point;
let combined = [...a1, ...a2];
// Optional chaining & nullish coalescing
let city = user?.address?.city;
let username = user?.name ?? "Anon";
LPP includes a built-in analyzer that catches issues before compilation:
fn example() -> int {
let x;
let y = x + 10; // ERROR: uninitialized variable
let z = 10 / 0; // ERROR: division by zero
return 0;
println("unreachable"); // WARNING: dead code
}
- β Division by zero detection
- β Uninitialized variable use
- β Dead code detection
- β Null dereference checks
- β Memory leak detection
- β Integer overflow warnings
LPP uses a multi-stage pipeline:
Source Code (.lpp)
β
Lexer (Tokenization)
β
Parser (AST Construction)
β
Static Analyzer (CFG + Data-Flow)
β
C++ Transpiler
β
g++/clang (Native Compilation)
β
Executable
Details in ARCHITECTURE.md.
- Quick Start
- Language Specification
- Advanced Features β Golf operators, iterate-while, ES6+ features
- Architecture Guide
- Static Analyzer Details
- Design Patterns
- Paradigms Guide
- Bug Fixes History
- Roadmap
- Systems Programming β Low-level performance, modern syntax
- Learning β Great introduction to compilers and type systems
- Rapid Prototyping β Fast C++ generation without memory headaches
- Embedded Development β Efficient binaries for constrained devices
- Fork repository
- Create feature branch
- Commit changes
- Push branch
- Open Pull Request
See the examples/ directory:
- LightJS β The original runtime that inspired LPP
MIT License β see LICENSE.
- Clang Static Analyzer for CFG-based analysis approach
- JavaScript/TypeScript for syntax inspiration
- Rust for modern language design principles
Built with β€οΈ for modern systems programming
β Star on GitHub β’ οΏ½οΏ½οΏ½ Report Bug β’ οΏ½οΏ½οΏ½ Request Feature