Prev Up Next
Go backward to 2.6 Internal Strategies
Go up to 2 Core Maude
Go forward to 2.8 LOOP-MODE and Metalanguage Uses

2.7 Parsing, Bubbles and Meta-Parsing

This section explains the parsing and meta-parsing functionalities of Maude. Section 2.7.1 presents a general overview of the design of the Maude Parser (MSCP). Section 2.7.2 explains how terms with user-definable mixfix syntax are parsed in a module and illustrates the basic functionalities of the parser with several examples. For convenience and expressiveness the signature of each module is extended with parentheses, Boolean connectives, some built-in polymorphic operators, sort test operators, and so on. Section 2.7.3 explains this extended signature of a module and how terms are parsed in it. Section 2.7.4 concentrates on the strategies for the specification of user-defined models of precedence/gathering patterns. Since a module's user-defined syntax can specify a general context-free grammar that can be ambiguous, parentheses may in general be needed to resolve such ambiguities. By means of the definition of precedence/gathering patterns, the user can control the precedence and the syntactic order of evaluation of operators to remove such ambiguities without recourse to unnecessary parentheses, while keeping the same syntax. Section 2.7.5 describes the rules used by Maude to assign default precedence values and gathering patterns. Finally, Section 2.7.6 explains what we might call linguistic reflection, that is, the possibility of parsing a term from which we then extract a grammar to parse some unanalyzed portions of that term--for example, parsing the top-level syntax of a module in a language allowing user-definable syntax, to obtain the grammar in which to parse expressions in that module--, is supported by means of "bubbles" and the metaparsing facility of META-LEVEL.

  • 2.7.1 MSCP Parser Design: An Overview
  • 2.7.2 Mixfix Parsing of Terms in a Module
  • 2.7.3 Parsing Terms in the Extended Signature of a Module
  • 2.7.4 Precedence and Gathering
  • 2.7.5 Default Precedence and Gathering
  • 2.7.6 Tokens, Bubbles and Metaparsing

  • Prev Up Next