ww+wcc: emit and lex // MODULE: <name> directive in combined.ww

This commit is contained in:
2026-05-11 14:54:56 +09:00
parent 5d91ee778e
commit d7036be0e5
9 changed files with 296 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
// MODULE: os
// os — process and filesystem facade. The body of each call lands
// either in libwwrt.a (rt_syscall trampoline) or libc bindings,
// depending on how the program was linked.
@@ -207,6 +208,7 @@ export fn getdents64(fd: i32, buf: *u8, n: u64) i64 = {
return syscall3(SYS_GETDENTS64, fd: i64, buf: i64, n: i64);
};
// MODULE: wcc
// selfhost/cmd/wcc/mem.ww — port of cmd/wcc/mem.c.
//
// Bump arena allocator. Backed by the runtime page allocator
@@ -314,6 +316,7 @@ export fn freearena(a: *arena) void = {
};
};
// MODULE: w6a
// selfhost/cmd/w6a/types.ww — types + constants shared across the
// w6a port. Mirrors cmd/w6a/a.h and cmd/w6c/6.out.h.
@@ -508,6 +511,7 @@ type asm_ = struct {
errs: i32,
};
// MODULE: w6a
// selfhost/cmd/w6a/lex.ww — port of cmd/w6a/lex.c.
//
// Character-level helpers for w6a's line-oriented parser. The parser
@@ -575,6 +579,7 @@ export fn parsenum(p: *u8, n: u64) (i64, u64) = {
return v, i;
};
// MODULE: w6a
// selfhost/cmd/w6a/parse.ww — port of cmd/w6a/parse.c.
//
// Line-oriented parser for the asm subset emitted by w6c.
@@ -1151,6 +1156,7 @@ export fn parse(a: *asm_) i32 = {
return a.errs;
};
// MODULE: w6a
// selfhost/cmd/w6a/asm.ww — port of cmd/w6a/asm.c.
//
// Encode the parsed aprog list into amd64 machine bytes, appending to
@@ -1833,6 +1839,7 @@ export fn encode(a: *asm_) i32 = {
return a.errs;
};
// MODULE: w6a
// selfhost/cmd/w6a/obj.ww — port of cmd/w6a/obj.c.
//
// Emit a tiny ELF64 relocatable object. Layout (in file order):
@@ -2127,6 +2134,7 @@ export fn emitelf(a: *asm_, fd: i32) i32 = {
return 0;
};
// MODULE: w6a
// selfhost/cmd/w6a/main.ww — port of cmd/w6a/main.c.
//
// w6a = amd64 assembler. Read .s, parse, encode, emit ELF .o.