selfhost: migrate tool sources to directory packages
Build w6a and w6l from package-main directories and expose the wcc backend through a narrow package API so w6c and wwdump no longer import implementation files. Retarget the remaining load-bearing fixtures and example sources to directory packages; retain the one intentional flat compiler collision as an explicitly composed raw unit.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
// Port of cmd/w6a/asm.c. Encoding subset matches what w6c emits — see
|
||||
// cmd/w6a/asm.c for the authoritative list.
|
||||
|
||||
package w6a;
|
||||
package main;
|
||||
|
||||
import os;
|
||||
import rt;
|
||||
import opcodes;
|
||||
import strings;
|
||||
|
||||
export fn emitbyte(a: *asm_, b: u8) void = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Port of cmd/w6a/lex.c.
|
||||
|
||||
package w6a;
|
||||
package main;
|
||||
|
||||
export fn isidstart(c: i32) bool = {
|
||||
if (c == 95) { return true; };
|
||||
|
||||
@@ -7,11 +7,6 @@ package main;
|
||||
import os;
|
||||
import rt;
|
||||
import strings;
|
||||
import opcodes;
|
||||
import lex;
|
||||
import parse;
|
||||
import asm;
|
||||
import obj;
|
||||
|
||||
fn cstreq(a: *u8, lit: str) bool = {
|
||||
let n: u64 = lit.len: u64;
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
//
|
||||
// Symtab indices: 0 = STN_UNDEF, 1.. = our syms. Only GLOBAL symbols.
|
||||
|
||||
package w6a;
|
||||
package main;
|
||||
|
||||
import os;
|
||||
import opcodes;
|
||||
|
||||
// Local wrappers around os.writeall's tagged return — collapse the
|
||||
// (i64 | oserror) back to a boolean / int sentinel for the
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Mirrors cmd/w6a/a.h and cmd/w6c/6.out.h.
|
||||
|
||||
package w6a;
|
||||
package main;
|
||||
|
||||
// Registers + operand kinds must stay numerically aligned with the
|
||||
// 6.out.h C enum so that ww-cgen output (which reads them via
|
||||
|
||||
@@ -10,12 +10,10 @@
|
||||
// instr := \tMNEM\t[OP1[, OP2]]
|
||||
// OP := $NUM | REG | NUM(REG) | (REG) | name(SB) | label
|
||||
|
||||
package w6a;
|
||||
package main;
|
||||
|
||||
import os;
|
||||
import strings;
|
||||
import lex;
|
||||
import opcodes;
|
||||
|
||||
fn streqlit(p: *u8, n: u64, lit: str) bool = {
|
||||
if (n != lit.len: u64) { return false; };
|
||||
|
||||
Reference in New Issue
Block a user