✓
Passing This code compiles and runs correctly.
Code
// MIRROR of 641_005_ordered_choice_same_head: a `[with]std/parser:grammar`
// declaration and its `std/parser:parse` use, both relocated into an imported
// module.
//
// parser is a SYNTHESIZING library — the grammar declaration appends the
// compiled rule machinery and `parse` refers to it by name. Both halves move
// together, so this pins the declaration-position and flow-position shapes at
// once for the library where the grammar's home decides what `parse` resolves.
import app/lib
app/lib:run()
Supporting Files
import std/parser
import std/io
[with]std/parser:grammar(csv)
! list l |> match(l)
| `[0-9]+` n |> lit(",") |> sub(list): r
| `[0-9]+` n -> n
pub tor run {}
run = std/parser:parse("7,8,9", grammar: csv)
| list { text } |> std/io:print.ln("ok {{ text:s }}")
| parse-error { line, col, expected, found } |> std/io:print.ln("err {{ line:d }}:{{ col:d }} expected {{ expected:s }} found {{ found:s }}")
Actual
ok 7,8,9
Expected output
ok 7,8,9
Flows
flow ~run click a branch to expand · @labels scroll to their anchor
run
Test Configuration
MUST_RUN