Files
ww/selfhost/test/uses.ww
Hojun-Cho 1657bdeda3 ww: import toolchain — C bootstrap + ww-side self-host (phases 0-10)
C bootstrap (phases 0-9):
  cmd/wwc, cmd/6c, cmd/6a, cmd/6l, cmd/ww, rt, lib/*.

ww-side self-host (phase 10):
  selfhost/cmd/wwc — ww-cgen frontend; bootstrap fixed point.
  selfhost/cmd/6a  — assembler; byte-identical to C 6a (test 991).
  selfhost/cmd/6l  — linker w/ archive (.a) support; byte-identical
                     to C 6l (test 992).
  selfhost/cmd/ww  — driver (build/run/version); byte-identical to
                     C ww (test 993).

make test: 15/15. make bootstrap: ww2.s == ww3.s, ww2.o == ww3.o,
ww2 == ww3 byte-identical, with the full ww-tooled chain.
2026-05-11 02:17:47 +09:00

30 lines
681 B
Plaintext

// selfhost/test/uses.ww — AST-diff fixture. Grows as parse.ww does.
// Currently exercises: `use IDENT;`, `def NAME: TYPE = LIT;`,
// `type NAME = TYPE;` (alias + struct), top-level `let NAME: TYPE = LIT;`.
//
// Function declarations are still recovered past — the body parser
// is the next major chunk. See selfhost/cmd/wwc/parse.ww header.
use os;
use mem;
use fmt;
def MAX_LINE: i32 = 4096;
def NAME: str = "ww";
def READY: bool = true;
type byte = u8;
type rune = i32;
type pos = struct {
file: str,
line: i32,
col: i32,
};
type buffer = [4096]u8;
type bytes = []u8;
type linkptr = *byte;
let nerrors: i32 = 0;
let nwarnings: i32 = 0;
let prog_name: str = "ww";