Abstract
Adaptable Parsing Expression Grammars (APEG) are a formal model whose main purpose is to formally describe the syntax of extensible languages and their extension mechanisms. APEG extends Parsing Expression Grammar model with the notion of syntactic attributes, which are values passed through parse tree nodes and used during the parsing process. A grammar is a first-class value passed to every nonterminal, and the rules used during the parsing are fetched from this grammar. The ability to change and pass different grammars is the key to dynamically extend the original language grammar. The reported implementation of APEG attributes uses strings and ad hoc Java code to manipulate and build grammars during parsing time. This approach has at least three disadvantages: a grammar specification becomes dependent on the language in which the functions to manipulate and build new grammars were implemented; we may not assure that the grammars built are always syntactically correct; and it is virtually impossible to prove that the generated parser does not lead to a infinite loop. In this work, we formally define an attribute language for APEG containing operators to manipulate grammars. As a result, new rules and grammars built during parsing time are syntactically correct. In addition, we define a restriction on APEG rules that assures that any generated parser will terminate on all inputs.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.