A Typed, Algebraic Approach to Parsing

被引:12
|
作者
Krishnaswami, Neelakantan R. [1 ]
Yallop, Jeremy [1 ]
机构
[1] Univ Cambridge, Cambridge, England
关键词
parsing; context-free languages; type theory; Kleene algebra;
D O I
10.1145/3314221.3314625
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
In this paper, we recall the definition of the context-free expressions (or mu-regular expressions), an algebraic presentation of the context-free languages. Then, we define a core type system for the context-free expressions which gives a compositional criterion for identifying those context-free expressions which can be parsed unambiguously by predictive algorithms in the style of recursive descent or LL(1). Next, we show how these typed grammar expressions can be used to derive a parser combinator library which both guarantees linear-time parsing with no backtracking and single-token lookahead, and which respects the natural denotational semantics of context-free expressions. Finally, we show how to exploit the type information to write a staged version of this library, which produces dramatic increases in performance, even outperforming code generated by the standard parser generator tool ocamlyacc.
引用
收藏
页码:379 / 393
页数:15
相关论文
共 50 条
  • [1] Algebraic Structures as Typed Objects
    Kredel, Heinz
    Jolly, Raphael
    [J]. COMPUTER ALGEBRA IN SCIENTIFIC COMPUTING, 2011, 6885 : 294 - +
  • [2] AMR Dependency Parsing with a Typed Semantic Algebra
    Groschwitz, Jonas
    Lindemann, Matthias
    Fowlie, Meaghan
    Johnson, Mark
    Koller, Alexander
    [J]. PROCEEDINGS OF THE 56TH ANNUAL MEETING OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS (ACL), VOL 1, 2018, : 1831 - 1841
  • [3] Towards Typed Semantics for Parsing Expression Grammars
    Ribeiro, Rodrigo
    Reis, Leonardo V. S.
    Feitosa, Samuel
    Cardoso, Elton M.
    [J]. XXIII BRAZILIAN SYMPOSIUM ON PROGRAMMING LANGUAGES, 2019, : 70 - 77
  • [4] Tabular parsing and algebraic transformations
    Schneider, KM
    [J]. THEORETICAL COMPUTER SCIENCE, 2003, 293 (02) : 365 - 389
  • [5] Typed Parsing and Unparsing for Untyped Regular Expression Engines
    Radanne, Gabriel
    [J]. PROCEEDINGS OF THE 2019 ACM SIGPLAN WORKSHOP ON PARTIAL EVALUATION AND PROGRAM MANIPULATION (PEPM '19), 2019, : 35 - 46
  • [6] Typed quote/antiquote or: Compile-time parsing
    Hinze, Ralf
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2011, 21 : 219 - 234
  • [7] Parsing Korean honorification phenomena in a typed feature structure grammar
    Kim, Jong-Bok
    Sells, Peter
    Yang, Jaehyung
    [J]. ADVANCES IN ARTIFICIAL INTELLIGENCE, PROCEEDINGS, 2006, 4013 : 254 - 265
  • [8] Towards an algebraic theory of typed mobile processes
    Deng, YX
    Sangiorgi, D
    [J]. THEORETICAL COMPUTER SCIENCE, 2006, 350 (2-3) : 188 - 212
  • [9] Semantics of a Typed Algebraic Lambda-Calculus
    Valiron, Benoit
    [J]. ELECTRONIC PROCEEDINGS IN THEORETICAL COMPUTER SCIENCE, 2010, (26): : 147 - 158
  • [10] Algebraic Structures on Typed Decorated Rooted Trees
    Foissy, Loic
    [J]. SYMMETRY INTEGRABILITY AND GEOMETRY-METHODS AND APPLICATIONS, 2021, 17