Results 1 
9 of
9
Monadic Parser Combinators
, 1996
"... In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higherorder functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an al ..."
Abstract

Cited by 57 (2 self)
 Add to MetaCart
In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higherorder functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this article is to provide a stepbystep tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this article can also be viewed as a first introduction to the use of monads in programming.
Monadic Parsing in Haskell
, 1993
"... This paper is a tutorial on defining recursive descent parsers in Haskell. In the spirit of onestop shopping , the paper combines material from three areas into a single source. The three areas are functional parsers (Burge, 1975; Wadler, 1985; Hutton, 1992; Fokker, 1995), the use of monads to stru ..."
Abstract

Cited by 56 (0 self)
 Add to MetaCart
This paper is a tutorial on defining recursive descent parsers in Haskell. In the spirit of onestop shopping , the paper combines material from three areas into a single source. The three areas are functional parsers (Burge, 1975; Wadler, 1985; Hutton, 1992; Fokker, 1995), the use of monads to structure functional programs (Wadler, 1990; Wadler, 1992a; Wadler, 1992b), and the use of special syntax for monadic programs in Haskell (Jones, 1995; Peterson et al. , 1996). More specifically, the paper shows how to define monadic parsers using do notation in Haskell.
Efficient Combinator Parsers
 In Implementation of Functional Languages, LNCS
, 1998
"... . Parser combinators enable the construction of recursive descent parsers in a very clear and simple way. Unfortunately, the resulting parsers have a polynomial complexity and are far too slow for realistic inputs. We show how the speed of these parsers can be improved by one order of magnitude usin ..."
Abstract

Cited by 11 (0 self)
 Add to MetaCart
. Parser combinators enable the construction of recursive descent parsers in a very clear and simple way. Unfortunately, the resulting parsers have a polynomial complexity and are far too slow for realistic inputs. We show how the speed of these parsers can be improved by one order of magnitude using continuations. These continuations prevents the creation of intermediate data structures. Furthermore, by using an exclusive orcombinator instead of the ordinary orcombinator the complexity for deterministic parsers can be reduced from polynomial to linear. The combination of both improvements turn parser combinators from a beautiful toy to a practically applicable tool which can be used for real world applications. The improved parser combinators remain very easy to use and are still able to handle ambiguous grammars. 1 Introduction Parser combinators [3, 6, 5, 8] are a beautiful illustration of the use of higher order functions and currying. By using a small set of parser combinators ...
Bottomup Grammar Analysis  A Functional Formulation
 Proceedings Programming Languages and SystemsESOP '94
, 1994
"... This paper discusses bottomup grammar analysis problems such as the Empty problem and the First problem. It defines a general class of bottom up grammar analysis problems, and from this definition it derives a functional program for performing bottomup grammar analysis. The derivation is purely ..."
Abstract

Cited by 7 (3 self)
 Add to MetaCart
This paper discusses bottomup grammar analysis problems such as the Empty problem and the First problem. It defines a general class of bottom up grammar analysis problems, and from this definition it derives a functional program for performing bottomup grammar analysis. The derivation is purely calculational, using theorems from lattice theory, the BirdMeertens calculus, and laws for listcomprehensions. Sufficient conditions guaranteeing the existence of a solution emerge as a byproduct of the calculation. The resulting program is used to construct programs for the Empty problem and the First problem. 1 Introduction Grammar analysis is performed in many different situations: Yacc tests whether or not its input grammar is LALR(1), parser generators contain functions for determining whether or not a nonterminal can derive the empty string (Empty) as part of determining the set of all symbols that can appear as the first symbol of a derived string (First), and for determining the ...
Constructing Functional Programs for Grammar Analysis Problems
 In Conference Record of FPCA '95, SIGPLANSIGARCHWG2.8 Conference on Functional Programming Languages and Computer Architecture
, 1995
"... This paper discusses the derivation of functional programs for grammar analysis problems, such as the Empty problem and the Reachable problem. Grammar analysis problems can be divided into two classes: topdown problems such as Follow and Reachable, which are described in terms of the contexts of n ..."
Abstract

Cited by 7 (3 self)
 Add to MetaCart
This paper discusses the derivation of functional programs for grammar analysis problems, such as the Empty problem and the Reachable problem. Grammar analysis problems can be divided into two classes: topdown problems such as Follow and Reachable, which are described in terms of the contexts of nonterminals, and bottomup problems such as Empty and First, which do not refer to contexts. In a previous paper we derive a program for bottomup grammar analysis problems. In this paper we derive a program for topdown grammar analysis problems by transforming the specification of an arbitrary topdown problem into a program. The existence of a solution is guaranteed provided some natural conditions are satisfied. Furthermore, we describe a general transformation that applies to both classes of grammar analysis problems. The result of this transformation is a program that avoids unnecessary computations in the computation of a fixed point. Constructor classes, which are used to abstract fr...
A Backtracking LR Algorithm for Parsing Ambiguous ContextDependent Languages
 In 2006 Conference of the Centre for Advanced Studies on Collaborative Research (CASCON
, 2006
"... Parsing contextdependent computer languages requires an ability to maintain and query data structures while parsing for the purpose of influencing the parse. Parsing ambiguous computer languages requires an ability to generate a parser for arbitrary contextfree grammars. In both cases we have tool ..."
Abstract

Cited by 4 (2 self)
 Add to MetaCart
Parsing contextdependent computer languages requires an ability to maintain and query data structures while parsing for the purpose of influencing the parse. Parsing ambiguous computer languages requires an ability to generate a parser for arbitrary contextfree grammars. In both cases we have tools for generating parsers from a grammar. However, languages that have both of these properties simultaneously are much more di#cult to parse. Consequently, we have fewer techniques. One approach to parsing such languages is to endow traditional LR systems with backtracking. This is a step towards a working solution, however there are number of problems. In this work we present two enhancements to a basic backtracking LR approach which enable the parsing of computer languages that are both contextdependent and ambiguous. Using our system we have produced a fast parser for C++ that is composed of strictly a scanner, a name lookup stage and parser generated from a grammar augmented with semantic actions and semantic `undo' actions. Language ambiguities are resolved by prioritizing grammar declarations.
Monadic Parser Combinators
, 1996
"... In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higherorder functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad , an a ..."
Abstract
 Add to MetaCart
In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higherorder functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad , an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this article is to provide a stepbystep tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this article can also be viewed as a first introduction to the use of monads in programming. 2 Graham Hutton and Erik Meijer Contents 1 Introduction 3 2 Combinator parsers 4 2.1 The type of parsers 4 2.2 Primitive parsers 4 2.3 Parser combinators 5 3 Parsers and monads 8 3.1 The parser monad 8 3.2 Monad comprehension ...
Functional Programming Paper Collection CPSC 521
, 2011
"... 2. Where do I begin? A problem solving approach in teaching functional ..."