• DocumentCode
    1594150
  • Title

    Automating Abstract Syntax Tree Construction for Context Free Grammars

  • Author

    Arusoaie, Andrei ; Vicol, D.I.

  • Author_Institution
    Fac. of Comput. Sci., Univ. of Alexandru Ioan Cuza, Iasi, Romania
  • fYear
    2012
  • Firstpage
    152
  • Lastpage
    159
  • Abstract
    In most of the compilers or programming languages tools, parsers are used for transforming human readable code into Parse Trees or Abstract Syntax Trees (AST). A popular method to create parsers is to use a parser generator. Advanced parser generators (e.g. ANTLR, SDF) are able to generate directly ASTs if the grammar is annotated with AST generation rules. These annotations are typically done manually, by adding to each grammar rule a constructor and associating an AST component to each constructor. This might be inconvenient for people with little experience in writing grammars or for those who already have a grammar for their language. In this paper, we present a generic method for inferring such AST generation rules and a tool which automatically generates the annotated grammar. Assuming you have a grammar for a language, some input programs and their corresponding ASTs, the tool will infer the rules for constructing the AST. If the input programs cover the whole range of the language syntax constructs then the parser corresponding to the generated annotated grammar is able to parse and transform into an AST any program of the given language.
  • Keywords
    computational linguistics; context-free grammars; program compilers; trees (mathematics); AST; Parse Trees; abstract syntax tree construction; compilers; context free grammars; generic method; grammar rule; input programs; parser generator; programming languages tools; Abstracts; Context; Generators; Grammar; Production; Syntactics; Vegetation; automated AST; context free grammars; tree matching;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    Symbolic and Numeric Algorithms for Scientific Computing (SYNASC), 2012 14th International Symposium on
  • Conference_Location
    Timisoara
  • Print_ISBN
    978-1-4673-5026-6
  • Type

    conf

  • DOI
    10.1109/SYNASC.2012.8
  • Filename
    6481024