Abridge - grammarware/slps GitHub Wiki
Given a reflexive chain production rule, i.e., a production rule whose defined nonterminal equals its body, this production rule is simply removed from the grammar, even if it contains some potentially valuable information (like labels and selectors).
Syntax
abridge:
production
Semantics
Reflexive chain productions are rarely encountered explicitly in the base-line grammars, but sometimes series of transformations result in them, and usually they are not needed. An example of a transformation sequence that yields a reflexive chain production can be a step from concrete syntax definition to abstract syntax definition. Concrete syntax usually needs explicit bracketing constructions for recursive composition, and after stripping away terminals and merging layers, these bracketing constructions become reflexive chain productions. The Factorial Language case study has shown the need for it.
Example
Consider this abstract syntax:
[constant] expr:
int
[neg] expr:
expr
[bracket] expr:
expr
After performing this transformation step:
abridge(
[bracket] expr:
expr
);
The grammar will be the same, but without the reflexive chain production labelled as “bracket” previously:
[constant] expr:
int
[neg] expr:
expr
Relevant files
shared/prolog/xbgf1.pro
shared/prolog/xbgf2.pro
shared/rascal/src/transform/library/Chaining.rsc
shared/xsd/xbgf.xsd
See also
- Abridge is a part of XBGF