Download Latest Version v1.19.1 source code.zip (599.1 kB) Google Add to Preferred Sources
Home / v1.19.1
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-10-01 876 Bytes
v1.19.1 source code.tar.gz 2026-10-01 570.9 kB
v1.19.1 source code.zip 2026-10-01 599.1 kB
Totals: 3 Items   1.2 MB 0

✨ New

enable_ast(collapse_mode, opt_mode, rules)

enable_ast(true) builds the optimized AST directly, keeping the nodes of the rules marked no_ast_opt. A program that optimizes with its own AstOptimizer(opt_mode, rules) can now have that same tree built directly by passing the list as a third argument:

:::cpp
parser.enable_ast(true, true, {"ARGUMENTS", "BLOCK"});

Marking those rules no_ast_opt instead would not give the same tree: a node of a no_ast_opt rule keeps its own source range when the parent it stands in for collapses onto it, so ranges would change.

On culebra's grammar, with 59 such rules over its 576 test and example files, the tree is identical in every field of every node, and parsing with the optimization takes 34% fewer instructions than enable_ast() followed by AstOptimizer (Release, min of 3 alternating runs).

Source: README.md, updated 2026-10-01