9c6b516453
- Reorganize repository to Rust-style layout: compiler/bootstrap/ compiler/selfhost/ compiler/tests/ library/std/ library/runtime/ tests/ tools/ - Add buxs/ Windows-compatible project root - Add borrow checker tests and implement: - Alias analysis (double mutable borrow detection) - Use-after-move detection for own T - Expand standard library: - Std::Os: Args, Env, Cwd, Chdir - Std::Time: NowMs, NowUs, SleepMs - Std::Process: Run, Output - Std::Io: PrintInt64 (fixes 32-bit truncation bug) - Add examples: os_time.bux, process.bux - Fix PrintInt to use int64_t in C runtime
17 lines
604 B
Nim
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
|