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.
This commit is contained in:
45
selfhost/test/sym_link.ww
Normal file
45
selfhost/test/sym_link.ww
Normal file
@@ -0,0 +1,45 @@
|
||||
// selfhost/test/sym_link.ww — link-and-run probe for the ww-cgen
|
||||
// against the sym/typ/ast/mem dep stack. Exercises arena (mem),
|
||||
// hashtable scope (sym), and pulls in typ/ast as type carriers.
|
||||
// Returns 42 on success; smaller values name the probe that broke.
|
||||
|
||||
use mem;
|
||||
use typ;
|
||||
use ast;
|
||||
use sym;
|
||||
|
||||
export fn main() i32 = {
|
||||
let a: *arena = newarena();
|
||||
if (a == nil) { return 1; };
|
||||
|
||||
let s: *scope = newscope(a, nil);
|
||||
if (s == nil) { return 2; };
|
||||
|
||||
let n1: str = "foo";
|
||||
let r1: *sym = scope_define(s, n1, SK_VAR, nil, nil);
|
||||
if (r1 == nil) { return 3; };
|
||||
|
||||
let n2: str = "bar";
|
||||
let r2: *sym = scope_define(s, n2, SK_TYPE, nil, nil);
|
||||
if (r2 == nil) { return 4; };
|
||||
|
||||
// Duplicate define in same scope must fail.
|
||||
let r3: *sym = scope_define(s, n1, SK_VAR, nil, nil);
|
||||
if (r3 != nil) { return 5; };
|
||||
|
||||
let l1: *sym = scope_lookup(s, n1);
|
||||
if (l1 == nil) { return 6; };
|
||||
if (l1.skind != SK_VAR) { return 7; };
|
||||
|
||||
let l2: *sym = scope_lookup(s, n2);
|
||||
if (l2 == nil) { return 8; };
|
||||
if (l2.skind != SK_TYPE) { return 9; };
|
||||
|
||||
// Not-found lookup returns nil.
|
||||
let n3: str = "baz";
|
||||
let l3: *sym = scope_lookup(s, n3);
|
||||
if (l3 != nil) { return 10; };
|
||||
|
||||
freearena(a);
|
||||
return 42;
|
||||
};
|
||||
Reference in New Issue
Block a user