Files
bux-lang/tests/test_ast_fields.nim
T
dimgigov ac969b37c1 v0.3.0: restructure directories
- 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
2026-06-06 04:53:39 +03:00

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