## Towards efficient, typed LR parsers (2005)

Venue: | In ACM SIGPLAN Workshop on ML, Electronic Notes in Theoretical Computer Science |

Citations: | 17 - 8 self |

### BibTeX

@TECHREPORT{Pottier05towardsefficient,,

author = {Cois Pottier},

title = {Towards efficient, typed LR parsers},

institution = {In ACM SIGPLAN Workshop on ML, Electronic Notes in Theoretical Computer Science},

year = {2005}

}

### Years of Citing Articles

### OpenURL

### Abstract

Abstract The LR parser generators that are bundled with many functional programming language implementations produce code that is untyped, needlessly inefficient, or both. We show that, using generalized algebraic data types, it is possible to produce parsers that are well-typed (so they cannot unexpectedly crash or fail) and nevertheless efficient. This is a pleasing result as well as an illustration of the new expressiveness offered by generalized algebraic data types.

### Citations

137 | Guarded recursive datatype constructors
- Xi, Chen, et al.
- 2003
(Show Context)
Citation Context ...y more complex, but vastly more expressive, type system. The key extra feature that we require is known (among other names) as generalized algebraic data types. This notion, due to Xi, Chen, and Chen =-=[26]-=-, was recently explored by a number of authors [4,14,21]. We show that appropriate use of generalized algebraic data types allows making a great amount of information about the pushdown automaton know... |

84 | Type inference for records in natural extension of ml
- Rémy
- 1994
(Show Context)
Citation Context ..., we are able to encode subset relationships in ML's type system, even though it is based on unification and lacks a notion of subtyping. This trick was inspired to us by R'emy's treatment of records =-=[16]-=-. It was independently discovered and studied by Fluet and Pucella [3]. This encoding works, but is extremely verbose when the automaton has many states. If the type system has rows [16], another, mor... |

74 | Languages of the future
- Sheard
- 2004
(Show Context)
Citation Context ...stem. The key extra feature that we require is known (among other names) as generalized algebraic data types. This notion, due to Xi, Chen, and Chen [26], was recently explored by a number of authors =-=[4,14,21]-=-. We show that appropriate use of generalized algebraic data types allows making a great amount of information about the pushdown automaton known to the typechecker. This, in turn, allows the typechec... |

58 | Objective ML: An effective object-oriented extension to ML. Theory And Practice of Object Systems
- Rémy, Vouillon
- 1998
(Show Context)
Citation Context ...erbose when the automaton has many states. If the type system has rows [16], another, more economical encoding is available. Objective Caml, for instance, has rows, which it uses to form object types =-=[17]-=-. Our prototype implementation of ML with generalized algebraic data types [19] also has full support for rows. The idea is to encode sets of states as rows whose labels are states and whose component... |

51 | Wobbly types: type inference for generalised algebraic data types. Microsoft Research
- Jones, Washburn, et al.
- 2004
(Show Context)
Citation Context ...true type safety, while eliminating much of the runtime overhead imposed by current versions of ML. Generalized algebraic data types are available today in version 6.4 of the Glasgow Haskell compiler =-=[13,24]-=-. We are studying their introduction into the Objective Caml compiler, and have used a separate prototype implementation of ML with generalized algebraic data types [15,19] to check that our prototype... |

49 |
The Objective Caml System
- Leroy
(Show Context)
Citation Context ...e, yacc [7] turns LALR(1) grammars, decorated with pieces of C code known as semantic actions, into executable C parsers. In the functional programming realm, each of Standard ML [10], Objective Caml =-=[8]-=-, and Haskell [12] comes with an adaptation of yacc. These tools are respectively known as ML-Yacc [23], ocamlyacc [8], and happy [9]. The parsers generated by yacc are fast, but are written in C, an ... |

40 | Stratified type inference for generalized algebraic data types
- Pottier, Régis-Gianas
- 2006
(Show Context)
Citation Context ...he Glasgow Haskell compiler [13,24]. We are studying their introduction into the Objective Caml compiler, and have used a separate prototype implementation of ML with generalized algebraic data types =-=[15,19]-=- to check that our prototype parser generator [18] indeed produces well-typed parsers. Our result is interesting on several grounds. First, it is original and can be used to modify ML-Yacc, ocamlyacc,... |

33 |
Phantom types and subtyping
- Fluet, Pucella
- 2002
(Show Context)
Citation Context ...though it is based on unification and lacks a notion of subtyping. This trick was inspired to us by R'emy's treatment of records [16]. It was independently discovered and studied by Fluet and Pucella =-=[3]-=-. This encoding works, but is extremely verbose when the automaton has many states. If the type system has rows [16], another, more economical encoding is available. Objective Caml, for instance, has ... |

30 |
Yacc: Yet another compiler-compiler. Computer Science
- Johnson
- 1975
(Show Context)
Citation Context ...down automaton that recognizes the language generated by the grammar. This parser construction technique has been made available to users of many mainstream programming languages. As an example, yacc =-=[7]-=- turns LALR(1) grammars, decorated with pieces of C code known as semantic actions, into executable C parsers. In the functional programming realm, each of Standard ML [10], Objective Caml [8], and Ha... |

24 | Constraint-based type inference for guarded algebraic data types
- Simonet, Pottier
- 2005
(Show Context)
Citation Context ...eals with only two cases. No compile-time warning is emitted, and no runtime check is required. This feature, referred to as dead code elimination by Xi [25], is also described by Simonet and Pottier =-=[22]-=-. Our prototype typechecker [19] implements it. We let the reader check that the code for "shift" and "reduce" transitions remains well-typed after these changes. Property (ii) is used when typechecki... |

22 |
Very fast LR parsing
- Pennello
- 1986
(Show Context)
Citation Context ..., 6} T {2, 9} * {7} F 10 oe {0, 4, 6, 7} ( {4} E {8} ) 11 Fig. 4. The automaton's invariant in parsers produced by happy -a, ML-Yacc, or ocamlyacc. This approach, studied in a number of earlier works =-=[11,5,2]-=-, has the disadvantage of leading to greater code size. Its key advantage, as far as we are concerned, is to make the code more amenable to analysis by a general-purpose type system. A secondary advan... |

18 | Certifying compilation for a language with stack allocation
- Jia, Spalding, et al.
- 2005
(Show Context)
Citation Context ...mmutable data structure is imposed by our somewhat na"ive type discipline. Designing type systems that support mutable stacks is an active area of research; see, for example, Jia et al.'s recent work =-=[6]-=-. 5 Understanding the automaton's invariant We asserted earlier that, by design of the action and goto tables, when a "reduce" action is taken, the contents of the top few stack cells are known and ma... |

16 | Very fast YACCCompatible Parsers (for Very Little Effort
- Bhamidipaty, Proebsting
- 1995
(Show Context)
Citation Context ..., 6} T {2, 9} * {7} F 10 oe {0, 4, 6, 7} ( {4} E {8} ) 11 Fig. 4. The automaton's invariant in parsers produced by happy -a, ML-Yacc, or ocamlyacc. This approach, studied in a number of earlier works =-=[11,5,2]-=-, has the disadvantage of leading to greater code size. Its key advantage, as far as we are concerned, is to make the code more amenable to analysis by a general-purpose type system. A secondary advan... |

10 |
Polymorphic typed defunctionalization and concretization
- Pottier, Gauthier
- 2005
(Show Context)
Citation Context ...stem. The key extra feature that we require is known (among other names) as generalized algebraic data types. This notion, due to Xi, Chen, and Chen [26], was recently explored by a number of authors =-=[4,14,21]-=-. We show that appropriate use of generalized algebraic data types allows making a great amount of information about the pushdown automaton known to the typechecker. This, in turn, allows the typechec... |

6 |
Even Faster LR Parsing
- Horspool, Whitney
- 1990
(Show Context)
Citation Context ..., 6} T {2, 9} * {7} F 10 oe {0, 4, 6, 7} ( {4} E {8} ) 11 Fig. 4. The automaton's invariant in parsers produced by happy -a, ML-Yacc, or ocamlyacc. This approach, studied in a number of earlier works =-=[11,5,2]-=-, has the disadvantage of leading to greater code size. Its key advantage, as far as we are concerned, is to make the code more amenable to analysis by a general-purpose type system. A secondary advan... |

5 |
A prototype typechecker for ML with generalized algebraic data types. http://cristal.inria.fr/ ~regisgia/software
- Régis-Gianas
- 2005
(Show Context)
Citation Context ...he Glasgow Haskell compiler [13,24]. We are studying their introduction into the Objective Caml compiler, and have used a separate prototype implementation of ML with generalized algebraic data types =-=[15,19]-=- to check that our prototype parser generator [18] indeed produces well-typed parsers. Our result is interesting on several grounds. First, it is original and can be used to modify ML-Yacc, ocamlyacc,... |

4 |
Happy: The parser generator for Haskell
- Marlow, Gill
- 2004
(Show Context)
Citation Context ...tional programming realm, each of Standard ML [10], Objective Caml [8], and Haskell [12] comes with an adaptation of yacc. These tools are respectively known as ML-Yacc [23], ocamlyacc [8], and happy =-=[9]-=-. The parsers generated by yacc are fast, but are written in C, an unsafe language. Likewise, the automata produced by ocamlyacc are encoded as tables of integers and of Objective Caml function closur... |

2 |
A prototype parser generator for ML with generalized algebraic data types. http://cristal.inria.fr/~regisgia/software
- R'egis-Gianas
- 2004
(Show Context)
Citation Context ...their introduction into the Objective Caml compiler, and have used a separate prototype implementation of ML with generalized algebraic data types [15,19] to check that our prototype parser generator =-=[18]-=- indeed produces well-typed parsers. Our result is interesting on several grounds. First, it is original and can be used to modify ML-Yacc, ocamlyacc, or happy so that they produce well3 In the follow... |

1 |
ML-Yacc User's Manual, April 2000. [24] The GHC team. The Glasgow Haskell compiler, March 2005. [25] Hongwei Xi. Dead code elimination through dependent types
- Tarditi, Appel
- 1999
(Show Context)
Citation Context ...ecutable C parsers. In the functional programming realm, each of Standard ML [10], Objective Caml [8], and Haskell [12] comes with an adaptation of yacc. These tools are respectively known as ML-Yacc =-=[23]-=-, ocamlyacc [8], and happy [9]. The parsers generated by yacc are fast, but are written in C, an unsafe language. Likewise, the automata produced by ocamlyacc are encoded as tables of integers and of ... |