Table of Contents
This section describes some of the terms used in the
sid
documentation.
An alternative is a sequence of items.
An exception handler is a special type of alternative. Each rule may have at most one exception handler. An exception handler is invoked if the current terminal does not match any of the expected terminals, if a predicate fails, or if an action raises an exception, within the scope of the exception handler.
This is the process of physically inlining a rule into another rule. It is done during the factoring process to turn the grammar into a form that a parser can be produced for. See the entry for factoring.
This is one of the transforms that sid
performs
on the grammar. See the overview
section for a description of the factoring process.
The first set of a rule (or alternative) is the set of terminals and predicates that can start that rule (or alternative).
The follow set of a rule is the set of terminals and predicates that can follow the rule in any of its invocations.
This is the process of outputting the code for parsing one rule within the function that parses another rule. This is normally done as part of the output process. Expansion is a form of inlining performed during the factoring process, but the inlining is done by modifying the grammar, rather than as part of the output phase.
An item is the equivalent of a statement in a conventional programming language. It can be an invocation of a rule, terminal, action or predicate, or an identity operation (assignment).
A name is an identifier that is used to pass information between rules and actions. Local names are defined within a rule, and only exist within the rule itself. Non-local names are defined in a rule's scoped definitions section and exists in all of the rules in that scope. Non-local rules are also saved and restored across calls to the rule that defines them.
Recursion is where a rule invokes itself. Direct recursion is where the rule invokes itself from one of its own alternatives; indirect recursion is where a rule invokes another rule (which invokes another rule etc.) which eventually invokes the original rule.
Left recursion is a form of recursion where all of the
recursive calls occur as the first item in an alternative. It is
not possible to produce a parser for a grammar that contains left
recursions, so sid
turns left recursions into right
recursions. This process is known as left recursion
elimination.
Right recursion is a form of recursion where all of the recursive calls occur as the last item in an alternative.
See rule.
A rule is a sequence of alternatives. A rule may contain a special alternative that is used as an exception handler. A rule is also referred to as a production; this term is normally used when talking about the definition of a rule.
A rule is said to be see-through if there is an expansion of the rule that does not contain any terminals or predicates.