Constructing parsers based on declarative specification of operator precedence is a very old research topic, and there are various existing approaches. However, these approaches are either tied to a particular parsing technique, or cannot deal with all corner cases found in programming languages. In this paper we present an implementation of declarative specification of operator precedence for general parsing that (1) is independent of the underlying parsing algorithm, (2) does not require any grammar transformation that increases the size of the grammar, (3) preserves the shape of parse trees of the original, natural grammar, and (4) can deal with intricate cases of operator precedence found in functional programming languages such as OCaml. Our new approach to operator precedence is formulated using data-dependent grammars, which extend context-free grammars with arbitrary computation, variable binding and constraints. We implemented our approach using Iguana, a data-dependent parsing framework, and evaluated it by parsing Java and OCaml source files. The results show that our approach is practical for parsing programming languages with complicated operator precedence rules.
Tue 19 Jan Times are displayed in time zone: (GMT-05:00) Guadalajara, Mexico City, Monterrey change
|10:30 - 11:00|
Anastasia IzmaylovaCentrum Wiskunde & Informatica, Ali AfroozehCentrum Wiskunde & Informatica, Tijs van der StormCWIDOI Pre-print
|11:00 - 11:30|
|11:30 - 12:00|
Shayan Najd, Sam LindleyUniversity of Edinburgh, Josef SvenningssonChalmers University of Technology, Sweden, Philip WadlerUniversity of EdinburghDOI