• DocumentCode
    2696407
  • Title

    SableCC, an object-oriented compiler framework

  • Author

    Gagnon, Etienne M. ; Hendren, Laurie J.

  • Author_Institution
    Sable Res. Group, McGill Univ., Montreal, Que., Canada
  • fYear
    1998
  • fDate
    3-7 Aug 1998
  • Firstpage
    140
  • Lastpage
    154
  • Abstract
    In this paper, we introduce SableCC, an object-oriented framework that generates compilers (and interpreters) in the Java programming language. This framework is based on two fundamental design decisions. Firstly, the framework uses object-oriented techniques to automatically build a strictly-typed abstract syntax tree that matches the grammar of the compiled language which simplifies debugging. Secondly, the framework generates tree-walker classes using an extended version of the visitor design pattern which enables the implementation of actions on the nodes of the abstract syntax tree using inheritance. These two design decisions lead to a tool that supports a shorter development cycle for constructing compilers. To demonstrate the simplicity of the framework, we present all the steps of building an interpreter for a mini-BASIC language. This example could be easily modified to provide on embedded scripting language in an application. We also provide a brief description of larger systems that have been implemented using the SableCC tool. We conclude that the use of object-oriented techniques significantly reduces the length of the programmer written code, can shorten the development time and finally, makes the code easier to read and maintain
  • Keywords
    object-oriented languages; program compilers; program debugging; program interpreters; Java programming language; SableCC; abstract syntax tree; debugging; embedded scripting language; grammar; inheritance; interpreters; mini-BASIC language; object-oriented compiler framework; programmer written code; tree-walker classes; Application software; Buildings; Computer languages; Computer science; Debugging; Java; Medical services; Program processors; Programming profession; Writing;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    Technology of Object-Oriented Languages, 1998. TOOLS 26. Proceedings
  • Conference_Location
    Santa Barbara, CA
  • Print_ISBN
    0-8186-8482-8
  • Type

    conf

  • DOI
    10.1109/TOOLS.1998.711009
  • Filename
    711009