Getting things ready…
Getting things ready…
An experimental, portable, performance-focused systems language, built from scratch to understand every layer between source code and hardware.
v0.1.0experimentalcompiler in C17LLVM backendMIT
PS C:\temper> temperc --version
temperc 0.1.0
PS C:\temper> temperc --help
Temper 0.1.0
Usage: temperc <source.temper> [-o output] [--emit-llvm | --emit-object]
[--clang path] [--target triple] [-O0 | -O2]
temperc --help | --versionPS C:\temper> Get-Content README.md | Select-String transparency
> **Keep the transparency and hardware control of C, provide stronger safety and better ergonomics, without requiring the conceptual complexity of a large systems language.**
Hardware Control
▲
│
Assembly
│
│
Temper
↙ ↘
Simplicity SafetyC is small and predictable but gives little protection. C++ and Rust are powerful, with a heavy conceptual cost. Assembly is total control, but tied to one architecture. Temper asks how much safety and ergonomics a small, explicit language can add while staying close to the hardware. It is an experiment, and the project will find out whether the trade-off is achievable.
PS C:\temper> Get-Content examples\return42.temper
fn main() -> i32:
return 20 + 22PS C:\temper> temperc examples\return42.temper --emit-llvm -o build\return42.ll; Get-Content build\return42.ll
; Generated by Temper 0.1.0
define i32 @main() {
entry:
%v2 = add i32 20, 22
ret i32 %v2
}PS C:\temper> temperc examples\return42.temper -o build\return42.exe; .\build\return42.exe; $LASTEXITCODE
42
42 is the expected program result, not a build error. The compiler turned Temper source into LLVM IR, and Clang turned that into a native executable.
PS C:\temper> Get-Content examples\arithmetic.temper
# Multiplication binds more tightly than addition.
fn main() -> i32:
return (10 - 3) * 6PS C:\temper> temperc examples\arithmetic.temper --emit-llvm -o build\arithmetic.ll; Get-Content build\arithmetic.ll
; Generated by Temper 0.1.0
define i32 @main() {
entry:
%v2 = sub i32 10, 3
%v4 = mul i32 %v2, 6
ret i32 %v4
}Read the numbering: %v2 is the subtraction, and %v4 multiplies it by 6. The literals take slots 0, 1 and 3, which is why the names skip.
The compiler only understands one shape so far, and this is it. Edit the expression: this is a small JavaScript mirror of the v0.1 lexer, parser and emitter, with the same precedence, error messages, instruction numbering and wrapping arithmetic.
fn main() -> i32: return
PS C:\temper> temperc repl.temper --emit-llvm
; Generated by Temper 0.1.0
define i32 @main() {
entry:
%v2 = add i32 20, 22
ret i32 %v2
}
✓ main() returns 42 (a 32-bit signed integer; overflow wraps)
✓ one parameterless main, returning i32, with one return statement ✓ + - * with unary signs and parentheses; * binds tighter; left to right ✓ + - * and negation wrap to 32 bits in every optimisation mode ✓ literals must fit a signed i32 (-2147483648 is accepted specially) ✓ spaces for indentation; tabs are rejected; # comments; LF or CRLF ✓ input capped at 16 MiB, expression nesting at 256 levels ✓ errors carry the file, line and column; unsupported syntax is rejected, never ignored
PS C:\temper> temperc big.temper # return 2147483648
big.temper:2:12: error: integer literal is outside i32 range
PS C:\temper> temperc tab.temper # a tab before return
tab.temper:2:1: error: use spaces, not tabs, for indentation
PS C:\temper> temperc divide.temper # return 20 / 4
divide.temper:2:15: error: unexpected byte 0x2f
Division is a future milestone, so / is rejected loudly instead of being quietly guessed at.
# src\ with line counts
src ├─ main.c 101 the driver: options, output mode, calls Clang ├─ frontend.c 234 characters → tokens → indentation → parser → typed instruction list ├─ codegen.c 27 instruction list → LLVM IR (wrapping operations, no nsw/nuw) ├─ platform.c 112 temp files and running a process, on Windows and POSIX └─ temper.h 29 the types they share
hello.temper
│
▼
Lexer ────── tokens, line/column, indent and dedent ✓ built
│
▼
Parser ───── precedence, one `return` ✓ built
│
▼
Typed IR ───── a small list of i32 operations ✓ built
│
▼
LLVM IR ────── text you can read ✓ built
│
▼
Clang ─────── object file, linker, native executable ✓ built
│
▼
Variables → control flow → functions → types → memory … nextThe compiler itself does not depend on Python or on the LLVM libraries. It writes textual LLVM IR, so the output is always inspectable, and calls Clang directly without a command shell. The next language step is local variables. Before touching the parser, the plan says to read return42.ll and find the add and the return.
PS C:\temper> temperc examples\return42.temper --emit-object --target aarch64-unknown-linux-gnu -o build\return42-arm64.o
# writes a Linux ELF object for AArch64: not a runnable program. # a Linux executable also needs its linker, startup files and target libraries.
Windows x86-64 ✓ builds and runs 42 returned, 11 conformance test groups pass
Linux AArch64 ✓ object output ELF64 and AArch64 machine id checked
… execution pending no ARM64 executable has been run yet
Raspberry Pi … next the model and OS are still to be chosen
Bare metal · laterA target is only claimed once it builds and runs the tests, not when it merely emits an object file. The suite covers both optimisation modes, generated arithmetic cases, 80 malformed inputs, diagnostics, and paths with spaces and shell characters.
# planning.md, section 8: milestones and their exit checks
3 of 10 milestones complete [###.......]
Planned, not built: the syntax below. The goal in the repo is a small language that mixes Python-like readability with C-like control, and that can eventually drive Raspberry Pi hardware, then run bare metal.
# PROPOSED syntax from planning.md. Not implemented yet.
fn add(a: i64, b: i64) -> i64:
return a + b
fn main() -> i32:
let answer = add(20, 22)
if answer == 42:
return 0
return 1The point is not only to make Temper work. It is to understand the systems concepts well enough to make it work myself: how source becomes tokens, then instructions, then machine code, then something a CPU runs. Temper is also the first project used to test Tandem's Learning Mode, where the AI explains, asks and reviews instead of just writing the code.
Explain → Question → I implement → Review → Hint → I correct
Self-hosting, a Temper compiler written in Temper, is the long-term milestone. It is unfinished by design, and the goal is already written down in the repository.
PS C:\temper> powershell -NoProfile -ExecutionPolicy Bypass -File scripts\setup-toolchain.ps1
# downloads a pinned LLVM-MinGW into .tools\, checks its SHA256, changes nothing globally
PS C:\temper> powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build.ps1 -Test
PS C:\temper> cmake -S . -B build -DCMAKE_BUILD_TYPE=Release; cmake --build build
# portable build: a C17 compiler, CMake and Clang. Windows is the only host verified so far.
STACK
Measured from the project's own source: 10 files.
Libraries & tools
PS C:\temper>