Files
bux-lang/tests/test_parse_ast.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

17 lines
604 B
Nim

import "../bootstrap/lexer", "../bootstrap/parser", "../bootstrap/ast", "../bootstrap/token"
import std/os
let source = readFile("../_selfhost/src/ast.bux")
let lexRes = tokenize(source, "ast.bux")
echo "Tokens: ", lexRes.tokens.len
echo "Errors: ", lexRes.hasErrors
let res = parse(lexRes.tokens, "ast.bux")
if res.module == nil:
echo "Parse failed, diagnostics: ", res.diagnostics.len
for d in res.diagnostics:
echo " ", d.message
else:
echo "Parsed OK, items: ", res.module.items.len
for i, decl in res.module.items:
echo "Decl ", i, " kind=", decl.kind, " name=", decl.declFuncName