alpag.net manual
Parser / Lookaheads and defaulting / Configuration
< Defaulting | Conflicts >

Configuration

Defaulting and lookahead prefetch can be controlled both globally and locally on production level

Global options

Several options exist for controlling lookahead use:

Parser.Reduction.Defaulting

This option turns defaulting globally on and off. Possible settings are:

Parser.Reduction.LookaheadFetch

Controls if lookahead token should be always fetched regardless if defaulting is enabled or not.

Parser.Reduction.PreviewCheck

When set to Yes parser simulates reductions until non-defaulted state is found. Then it verifies next input symbol using action fable for non-defaulted state. This option enables early error reporting for defaulted states.

Parser.Reduction.ExplicitDefaultingPurpose

User can control defaulting behavior on per-production level using options set for individual productions. User's declarations can be interpreted as either advisory hints or mandatory requirements. This option sets interpretation of these declarations:

Parser.Reduction.LookaheadContextDefaulting

Grammar productions can be declared with explicit lookahead context. This option controls defaulting when reducing productions with lookahead context. Possible values are:

Local defaulting control

It is possible to control defaulting on per-production level. Following options can be placed at the end of grammar production:

%nostdef

Declares that state at the end of production should not be defaulted

%stdef or %nolah

Declares that state at the end of production should be defaulted (no lookahead symbol should be fetched).

Declaration made at the end of production applies to all automaton states where this production is reduced.

It is possible to make conflicting declarations for different productions. If Parser.Reduction.ExplicitDefaultingPurpose is set to Functional colliding declarations produce an error.

< Defaulting | Conflicts >
Alpag Manual