PEGO

G060: Ordinary Typed Direct Rules

An eligible ordinary typed rule can match and run its action directly in its generated method, avoiding per-expression dispatch and runtime capture-frame plumbing.

Mechanism and Invariants

Direct bodies use Go-local captures and failure labels. Backtracking saves/restores captures, input, environment and recovered errors; repetition clears element locals each iteration. Actions read locals directly and constructors receive rule ranges. Unsupported ordinary layouts stay general. LR, Operators Rule, cut and recovery extensions use separately selected routes.

Scope and State

Default eligible generated typed Go routes only. Node generation shares emitter infrastructure but has different eligibility and ownership. TypeScript and engine/VM matching do not use these Go direct bodies.

Reference Control

No universal ordinary-direct-rule disable option is maintained. The cut/LR/Operators/layout/recovery generation controls select separate extension groups, not the entire original ordinary route.

Evidence and Implementation

Historical record 060 reports JSON typed timing 6.44 to 3.86 ms, XML 6.96 to 4.34 ms and lower frame allocation on its measured grammars. That body-lowering change does not establish the current isolated effect or benefits for unsupported rules.

Evidence records: 060.

Source owners: Generator.flowTypedRule, typed framed body lowering, GenOptions private typed controls, runtime invocation ownership.

The comparison policy distinguishes same-source controls, historical changes and full checkpoints.

Related mechanisms: G140, G150, G160, G200.

Optimization Catalog