ac969b37c1
- src/ ← compiler/selfhost/ (canonical Bux compiler) - bootstrap/ ← compiler/bootstrap/ (Nim bootstrap) - lib/ ← library/std/ (standard library) - rt/ ← library/runtime/ (C runtime) - tests/ ← compiler/tests/ (unit tests) - Remove _selfhost/ (built into build/selfhost/ now) - Update all path references (Makefile, cli.nim, cli.bux, docs) - Bump version to 0.3.0
16 lines
704 B
Nim
16 lines
704 B
Nim
import "../bootstrap/lexer", "../bootstrap/parser", "../bootstrap/ast"
|
|
|
|
let source = readFile("../_selfhost/src/ast.bux")
|
|
let lexRes = tokenize(source, "ast.bux")
|
|
let res = parse(lexRes.tokens, "ast.bux")
|
|
if res.module != nil:
|
|
echo "Module items: ", res.module.items.len
|
|
for decl in res.module.items:
|
|
if decl.kind == dkStruct:
|
|
echo "Struct: ", decl.declStructName, " fields: ", decl.declStructFields.len
|
|
elif decl.kind == dkModule:
|
|
echo "Inner module: ", decl.declModuleName, " items: ", decl.declModuleItems.len
|
|
for inner in decl.declModuleItems:
|
|
if inner.kind == dkStruct:
|
|
echo " Struct: ", inner.declStructName, " fields: ", inner.declStructFields.len
|