Adaptive LL(*) Parsing: The Power of Dynamic Analysis

被引:0
|
作者
Parr, Terence [1 ]
Harwell, Sam [2 ]
Fisher, Kathleen [3 ]
机构
[1] Univ San Francisco, San Francisco, CA 94117 USA
[2] Univ Texas Austin, Austin, TX 78712 USA
[3] Tufts Univ, Medford, MA USA
关键词
Algorithms; Languages; Theory; nondeterministic parsing; DFA; augmented transition networks; grammar; ALL(*); LL(*); GLR; GLL; PEG;
D O I
10.1145/2714064.2660202
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Despite the advances made by modern parsing strategies such as PEG, LL(*), GLR, and GLL, parsing is not a solved problem. Existing approaches suffer from a number of weaknesses, including difficulties supporting side-effecting embedded actions, slow and/or unpredictable performance, and counter-intuitive matching strategies. This paper introduces the ALL(*) parsing strategy that combines the simplicity, efficiency, and predictability of conventional top-down LL(k) parsers with the power of a GLR-like mechanism to make parsing decisions. The critical innovation is to move grammar analysis to parse-time, which lets ALL(*) handle any non-left-recursive context-free grammar. ALL(*) is O(n(4)) in theory but consistently performs linearly on grammars used in practice, outperforming general strategies such as GLL and GLR by orders of magnitude. ANTLR 4 generates ALL(*) parsers and supports direct left-recursion through grammar rewriting. Widespread ANTLR 4 use (5000 downloads/month in 2013) provides evidence that ALL(*) is effective for a wide variety of applications.
引用
收藏
页码:579 / 598
页数:20
相关论文
共 50 条
  • [1] Adaptive LL(∗) parsing: The power of dynamic analysis
    Parr, Terence
    Harwell, Sam
    Fisher, Kathleen
    ACM SIGPLAN Notices, 2014, 49 (10): : 579 - 598
  • [2] Dynamic LL(k) parsing
    Russmann, A
    ACTA INFORMATICA, 1997, 34 (04) : 267 - 289
  • [3] ON LL(K) PARSING
    SIPPU, S
    SOISALONSOININEN, E
    INFORMATION AND CONTROL, 1982, 53 (03): : 141 - 164
  • [4] Parallel LL parsing
    Ladislav Vagner
    Bořivoj Melichar
    Acta Informatica, 2007, 44 : 1 - 21
  • [5] Parallel LL parsing
    Vagner, Ladislav
    Melichar, Borivoj
    ACTA INFORMATICA, 2007, 44 (01) : 1 - 21
  • [6] Parallel LL parsing
    Ladislav Vagner
    Bořivoj Melichar
    Acta Informatica, 2007, 44 (1) : 73 - 73
  • [7] On parsing LL-languages
    Blum, N
    THEORETICAL COMPUTER SCIENCE, 2001, 267 (1-2) : 49 - 59
  • [8] Zippy LL(1) Parsing with Derivatives
    Edelmann, Romain
    Hamza, Jad
    Kuncak, Viktor
    PROCEEDINGS OF THE 41ST ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION (PLDI '20), 2020, : 1036 - 1051
  • [9] AN INCREMENTAL LL(1) PARSING ALGORITHM
    YANG, W
    INFORMATION PROCESSING LETTERS, 1993, 48 (02) : 67 - 72
  • [10] Kind Parsing: An Adaptive Parsing Technique
    Zemlicka, Michal
    Sasek, Pavel
    PROCEEDINGS OF THE SECOND INTERNATIONAL CONFERENCE ON ADAPTIVE AND SELF-ADAPTIVE SYSTEMS AND APPLICATIONS (ADAPTIVE 2010), 2010, : 194 - 199