001 parser userland

✓ Passing This code compiles and runs correctly.

Code

// Test: User-land parser access
// Verify that $std/parser is available at runtime for dynamic parsing

~import "$std/parser"
~import "$std/io"

const std = @import("std");

// We need an allocator available at runtime
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();

// The source we want to parse
const test_source = "~greet()";

// Main flow - parse and report
~std.parser:parse.source(source: test_source, file_name: "test.kz", allocator: allocator)
| parsed p |> std.io:print.ln("Parser works! Got AST with {{ p.ast.source_file.items.len }} items")
| parse_error e |> std.io:print.ln("Parse failed: {{ e.message }}")
input.kz

Expected Output

Parser works! Got AST with 1 items

Test Configuration

MUST_RUN