Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete
Self-hosted compiler (selfhost/*.ludic), runtime, examples, editor tooling, and docs. Phase 1 of the syntax-redesign cohesion pass has landed: edge-system fix, signature-query, when-alias, and the documentation truth-pass. Suite green (14/14), C-free bootstrap fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
985f9ad8f2
418 changed files with 39065 additions and 0 deletions
22
selfhost/io.ludic
Normal file
22
selfhost/io.ludic
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# io.ludic — reading the input file and writing the output, plus tiny stdio.
|
||||
# The compiler reads one .ludic file whole and emits LLVM IR text to stdout.
|
||||
|
||||
fn read_file(path: str) -> ptr {
|
||||
let f = file_open(path, "rb")
|
||||
if ptr_is_null(f) { return ptr_null() }
|
||||
file_seek(f, 0, 2)
|
||||
let n = file_tell(f)
|
||||
file_seek(f, 0, 0)
|
||||
let buf = mem_alloc(n + 1)
|
||||
file_read(f, buf, n)
|
||||
poke8(buf, n, 0)
|
||||
file_close(f)
|
||||
return buf
|
||||
}
|
||||
|
||||
# length of a NUL-terminated buffer
|
||||
fn cstr_len(s: ptr) -> int {
|
||||
let n = 0
|
||||
while peek8(s, n) != 0 { n = n + 1 }
|
||||
return n
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue