rumil 0.6.0
rumil: ^0.6.0 copied to clipboard
Parser combinator library for Dart with left recursion, stack-safe trampolining, typed errors, lazy error construction, and sealed ADT design.
0.6.0 #
Synchronized release across all rumil-dart packages. Additive for
rumil.
position()primitive: a zero-width parser that yields the current byte offset. Combines withZipfor span capture:position().zip(p).zip(position())produces((start, value), end)in one pass.
0.5.0 #
Interpreter optimizations and API refinements.
- Breaking:
Locationchanged fromextension typetofinal class. Line/column now computed lazily from offset — eliminates per-character write barriers. Constructor changed from named parameters toLocation(input, offset). - Breaking:
Snapshottypedef removed.ParserState.save()returnsint,restore()takesint.ParserState.line/columngetters removed — usestate.location.lineinstead. - Perf: Eliminate terminal re-boxing in trampoline (no intermediate Result allocation per terminal dispatch).
- Perf: Replace
late finalwith nullable cache (??=) inPartial/Failureerror fields — removes hidden initialization check on WasmGC. - Perf: Add
Parser.isSimpleproperty for save/restore skipping inOr,Optional,Many,SkipMany. - Perf: Fuse
Capture(Many(p))/Capture(Many1(p))in interpreter — skip intermediate list allocation. - 5-9% faster on AOT native, 30-52% faster on WasmGC across all format parser benchmarks.
0.4.0 #
- Fix:
RecoverWitheagerly evaluates error thunks at recovery time. Lazy thunks in_satisfyManyclosed overParserStateand read stale offsets when evaluated later, causingRangeErroron.errorsaccess. _satisfyManycapturesstate.currentCharinto a local before closures.
0.3.0 #
- Doc on
MemoKey.id. public_member_api_docslint enforced.- Version aligned with other rumil packages.
0.2.0 #
- Breaking:
fail()renamed tofailure()to avoid conflict withpackage:test. - Doc comments on all public API elements.
rule()doc: guidance on placement (postfix level, not top level).lexeme()doc: note about whitespace handling forchainl1operands.
0.1.0 #
- Core parser combinators: sealed Parser ADT with 26 subtypes, external interpreter, defunctionalized trampoline
- Warth seed-growth left recursion via
rule() - Stack-safe to 10M+ operations
- Typed errors with source location (line, column, offset)
- Lazy error construction via
late finalthunks - RadixNode O(m) string matching
- Full combinator DSL:
.zip(),.thenSkip(),.skipThen(),|,.map,.flatMap,.many,.sepBy,.chainl1,.chainr1,.between,.capture,.memoize - Format parsers: JSON (RFC 8259), CSV (RFC 4180), XML, TOML (v1.0.0), YAML (simplified 1.2), Proto3 schema
- AST decoders for JSON, TOML, YAML with
ObjectAccessorpattern - Formula evaluator with operator precedence via
chainl1, variables, custom functions - Binary codec: ZigZag, LEB128 Varint, BinaryCodec with
xmap+product2–product6composition - build_runner codegen for
@binarySerializableclasses and sealed hierarchies