Files
brolang/README.md
T
2026-06-09 23:05:28 +02:00

1.2 KiB

brolang

Prototype error-tolerant Brolang compiler written in Odin.

odin build . -out:brolang
./brolang examples/prototype.bro -o /tmp/prototype
/tmp/prototype

Compilation phases are isolated under compiler/:

source -> lexer -> parser/AST -> checker/HIR -> lower/IR -> opt -> LLVM -> zig cc

Source diagnostics do not block executable generation. When recovery is possible, invalid code lowers to runtime diagnostic traps and the compiler returns status 1. Infrastructure or backend failures return status 2.

Current prototype features:

  • Newline-terminated, multiline statements and # comments
  • Immutable :: bindings, mutable function-local = bindings, and _ sinks
  • i8, i16, i32, i64, and loose integer-constrained int
  • Contextual integer constants and compile-time folding of literal addition trees
  • Demand-monomorphized Brolang and C-ABI functions
  • Checked signed addition
  • Static, eager runtime, and deferred problematic globals
  • Runtime diagnostics followed by llvm.trap

Compiler exit statuses:

  • 0: executable produced without source diagnostics
  • 1: executable produced with source diagnostics and embedded traps
  • 2: executable could not be produced