@neftedollar/lllc
v1.2.2
Published
lllc — compiler for ll-lang, a minimal statically-typed functional language that compiles to F#, TypeScript, Python, Java, and C#.
Maintainers
Readme
@neftedollar/lllc
ll-lang compiler — write once in a minimal statically-typed functional language, compile to TypeScript (and F#, Python, Java, C#).
module App
-- ll-lang source
greet(name Str) Str = "Hello, " ++ name ++ "!"
Result A E = Ok A | Err E
safeDivide(a Float)(b Float) Result[Float, Str] =
if b == 0.0
Err "division by zero"
else Ok (a / b)Compiles to idiomatic TypeScript:
// greet.ts — generated by lllc
export function greet(name: string): string {
return "Hello, " + name + "!";
}
type Result<A, E> = { tag: "Ok"; value: A } | { tag: "Err"; error: E };
export function safeDivide(a: number, b: number): Result<number, string> {
if (b === 0.0) return { tag: "Err", error: "division by zero" };
return { tag: "Ok", value: a / b };
}Install
Requires Bun ≥ 1.0. No .NET needed for TypeScript/JavaScript output.
npm install -g @neftedollar/lllc
# or
bun install -g @neftedollar/lllcQuick start
# Create a file
cat > hello.lll << 'EOF'
module Hello
main() = printfn "Hello, ll-lang!"
EOF
# Compile to TypeScript
lllc build --target ts hello.lll
# → hello.ts
# Compile and run via TypeScript
lllc run --target ts hello.lll
# Hello, ll-lang!
# Type-check only (no output)
lllc check --target ts hello.lllWhy ll-lang?
- No ceremony — no braces, no semicolons, no
functionkeyword. Types are uppercase, values are lowercase. - Hindley-Milner inference — write functions without type annotations; the compiler infers everything.
- Algebraic data types — sum types, pattern matching, exhaustiveness checks at compile time.
- One source, five targets — same
.lllfile compiles to TypeScript, F#, Python, Java, and C#. - LLM-optimized — compact error format (
E001 12:5 TypeMismatch) designed for AI agents.
Same source → all targets
lllc build app.lll # → app.fs (F#)
lllc build --target ts app.lll # → app.ts (TypeScript)
lllc build --target py app.lll # → app.py (Python)
lllc build --target java app.lll # → app.java (Java 21)
lllc build --target cs app.lll # → app.cs (C#)CLI reference
lllc build [--target ts] <file.lll> compile single file
lllc build [--target ts] [dir] compile project (reads lll.toml)
lllc check [--target ts] <file.lll> type-check only, no output
lllc run [--target ts] <file.lll> compile and run
lllc new <name> scaffold new project
lllc mcp run MCP server (for Claude Code / Cursor)MCP integration (for AI coding agents)
// .cursor/mcp.json or claude_desktop_config.json
{
"mcpServers": {
"lllc": {
"command": "lllc",
"args": ["mcp"]
}
}
}The agent gains 10 structured tools: compile_file, check_file, run_file, lookup_error, stdlib_search, and more — no shell-output parsing required.
Language in 30 seconds
module Examples
-- value binding
pi = 3.14159
-- curried function with type annotation
add(a Int)(b Int) Int = a + b
-- sum type (algebraic data type)
Shape = Circle Float | Rect Float Float
-- exhaustive pattern match (compiler enforces all cases)
area(s Shape) Float =
match s
| Circle r -> pi * r * r
| Rect w h -> w * h
-- parametric type
Maybe A = Some A | None
-- type-safe tag (zero-cost wrapper)
tag UserId
getUser(id Str[UserId]) Maybe[Str] = Some "alice"Links
- GitHub: Neftedollar/ll-lang
- Language spec: docs/language-spec.md
- PyPI package: lllc
- NuGet package: lllc
License
MIT
