Operator Precedence for Data-Dependent Grammars

被引:3
|
作者
Afroozeh, Ali [1 ]
Izmaylova, Anastasia [1 ]
机构
[1] Ctr Wiskunde & Informat, Amsterdam, Netherlands
关键词
Parsing; data-dependent grammars; disambiguation; operator precedence; declarative syntax definition;
D O I
10.1145/2847538.2847540
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
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.
引用
收藏
页码:13 / 24
页数:12
相关论文
共 50 条
  • [1] Semantics and Algorithms for Data-dependent Grammars
    Jim, Trevor
    Mandelbaum, Yitzhak
    Walker, David
    [J]. ACM SIGPLAN NOTICES, 2010, 45 (01) : 417 - 430
  • [2] Semantics and Algorithms for Data-dependent Grammars
    Jim, Trevor
    Mandelbaum, Yitzhak
    Walker, David
    [J]. POPL'10: PROCEEDINGS OF THE 37TH ANNUAL ACM SIGPLAN-SIGACT SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES, 2010, : 417 - 430
  • [3] Parallel parsing of operator precedence grammars
    Barenghi, Alessandro
    Reghizzi, Stefano Crespi
    Mandrioli, Dino
    Pradella, Matteo
    [J]. INFORMATION PROCESSING LETTERS, 2013, 113 (07) : 245 - 249
  • [4] NOTE ON WEAK OPERATOR PRECEDENCE GRAMMARS
    SUDBOROUGH, IH
    [J]. INFORMATION PROCESSING LETTERS, 1977, 6 (06) : 213 - 218
  • [5] NOTE ON WEAK OPERATOR PRECEDENCE GRAMMARS
    SUDBOROUGH, IH
    [J]. INFORMATION PROCESSING LETTERS, 1978, 7 (05) : 213 - 218
  • [6] Beyond operator-precedence grammars and languages
    Reghizzi, Stefano Crespi
    Pradella, Matteo
    [J]. JOURNAL OF COMPUTER AND SYSTEM SCIENCES, 2020, 113 : 18 - 41
  • [7] OPERATOR PRECEDENCE GRAMMARS AND THE NON-COUNTING PROPERTY
    CRESPIREGHIZZI, S
    GUIDA, G
    MANDRIOLI, D
    [J]. SIAM JOURNAL ON COMPUTING, 1981, 10 (01) : 174 - 191
  • [8] Cyclic Operator Precedence Grammars for Improved Parallel Parsing
    Chiari, Michele
    Mandrioli, Dino
    Pradella, Matteo
    [J]. DEVELOPMENTS IN LANGUAGE THEORY, DLT 2024, 2024, 14791 : 98 - 113
  • [9] Adversarial Training is a Form of Data-dependent Operator Norm Regularization
    Roth, Kevin
    Kilcher, Yannic
    Hofmann, Thomas
    [J]. ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS (NEURIPS 2020), 2020, 33
  • [10] LINEAR PRECEDENCE FUNCTIONS FOR WEAK PRECEDENCE GRAMMARS
    AHO, AV
    ULLMAN, JD
    [J]. INTERNATIONAL JOURNAL OF COMPUTER MATHEMATICS, 1972, 3 (2-3) : 149 - 155