public final class PProduction extends Object
Actual items can be bound to some identifiers which can be used in the semantic actions. Their general form follows the following grammar:
actual := TERMINAL | param | nterm[<actual, ...>]where the terminals are the tokens declared in the parameterized grammar, the non-terminals are (possibly parameterized) rules of the grammar, and
param
refers to the formal parameters available in the rule
the production is associated to. In particular, parameters
can only be used as leaves and are thus not second-order;
also each parameterized non-terminal must be fully applied.Modifier and Type | Class and Description |
---|---|
static class |
PProduction.ActionItem
Represents a semantic action item, i.e. a semantic
action which is performed by the generated parser
when the enclosing production rule is executed.
|
static class |
PProduction.Actual
Represents an actual production item, i.e.
|
static class |
PProduction.ActualExpr
An expression representing the application of some grammar rule,
potentially via applications of parameterized rules of the grammar
to other symbols or expressions.
|
static class |
PProduction.Builder
Builder class for productions, allows adding
production items incrementally
|
static class |
PProduction.Continue
Represents a continuation of the current rule,
and unlike the equivalent actual,
this allows the generator to produce an optimized
tail-recursive call.
|
static class |
PProduction.Item
The base class for production items.
|
static class |
PProduction.ItemKind
Enumeration which describes the different kinds of
implementations of
PProduction.Item . |
Modifier and Type | Field and Description |
---|---|
List<PProduction.Item> |
items
The list of production items in this production, in order
|
Constructor and Description |
---|
PProduction(List<PProduction.Item> items)
Builds a grammar production based on the given parameters
|
Modifier and Type | Method and Description |
---|---|
Iterable<PProduction.Actual> |
actuals()
This does not include potential continuations, although
on many aspects they act as actuals.
|
@Nullable PProduction.Continue |
continuation() |
String |
toString() |
public final List<PProduction.Item> items
public PProduction(List<PProduction.Item> items)
items
- IllegalArgumentException
- if items
contains
a PProduction.Continue elsewhere than as the last itempublic Iterable<PProduction.Actual> actuals()
items
public @Nullable PProduction.Continue continuation()
null
otherwise