A Semantic Framework for PEGs

11/09/2020
by   Sérgio Medeiros, et al.
0

Parsing Expression Grammars (PEGs) are a recognition-based formalism which allows to describe the syntactical and the lexical elements of a language. The main difference between Context-Free Grammars (CFGs) and PEGs relies on the interpretation of the choice operator: while the CFGs' unordered choice e | e' is interpreted as the union of the languages recognized by e and e, the PEGs' prioritized choice e/e' discards e' if e succeeds. Such subtle, but important difference, changes the language recognized and yields more efficient parsing algorithms. This paper proposes a rewriting logic semantics for PEGs. We start with a rewrite theory giving meaning to the usual constructs in PEGs. Later, we show that cuts, a mechanism for controlling backtracks in PEGs, finds also a natural representation in our framework. We generalize such mechanism, allowing for both local and global cuts with a precise, unified and formal semantics. Hence, our work strives at better understanding and controlling backtracks in parsers for PEGs. The semantics we propose is executable and, besides being a parser with modest efficiency, it can be used as a playground to test different optimization ideas. More importantly, it is a mathematical tool that can be used for different analyses.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/10/2017

A New Semantic Theory of Natural Language

Formal Semantics and Distributional Semantics are two important semantic...
research
09/29/2020

A Survey on Semantic Parsing from the perspective of Compositionality

Different from previous surveys in semantic parsing (Kamath and Das, 201...
research
06/13/2022

Transition-based Abstract Meaning Representation Parsing with Contextual Embeddings

The ability to understand and generate languages sets human cognition ap...
research
10/22/2019

Transductive Parsing for Universal Decompositional Semantics

We introduce a transductive model for parsing into Universal Decompositi...
research
09/10/2019

Core Semantic First: A Top-down Approach for AMR Parsing

We introduce a novel scheme for parsing a piece of text into its Abstrac...
research
07/13/2020

A theory of interaction semantics

The aim of this article is to delineate a theory of interaction semantic...
research
07/11/2019

Executable formal semantics for the POSIX shell

The POSIX shell is a widely deployed, powerful tool for managing compute...

Please sign up or login with your details

Forgot password? Click here to reset