package-type imports
This commit is contained in:
@@ -4,26 +4,42 @@ Prototype error-tolerant Brolang compiler written in Odin.
|
||||
|
||||
```sh
|
||||
odin build . -out:brolang
|
||||
./brolang examples/prototype.bro -o /tmp/prototype
|
||||
./brolang examples/programs/prototype -o /tmp/prototype
|
||||
/tmp/prototype
|
||||
```
|
||||
|
||||
Compilation phases are isolated under `compiler/`:
|
||||
|
||||
```text
|
||||
source -> lexer -> parser/AST -> checker/HIR -> lower/IR -> opt -> LLVM -> zig cc
|
||||
package loader -> per-file 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`.
|
||||
Top-level function bodies are semantically checked lazily when a concrete
|
||||
specialization is demanded.
|
||||
|
||||
Every immediate `.bro` file in the input directory belongs to the root
|
||||
package. Imports are relative directory paths and are local to the file that
|
||||
declares them:
|
||||
|
||||
```bro
|
||||
import "../math"
|
||||
other_math :: import "../math"
|
||||
|
||||
value :: math.sum(other_math.value, 1)
|
||||
```
|
||||
|
||||
Current prototype features:
|
||||
|
||||
- Newline-terminated, multiline statements and `#` comments
|
||||
- Newline-terminated, multiline statements; `}` may terminate a block's final statement
|
||||
- `#` 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
|
||||
- Directory packages with merged declarations and file-local relative imports
|
||||
- Qualified imported globals and functions with package-aware symbol mangling
|
||||
- Demand-monomorphized Brolang and C-ABI functions
|
||||
- Checked signed addition
|
||||
- Static, eager runtime, and deferred problematic globals
|
||||
|
||||
Reference in New Issue
Block a user