• DocumentCode
    3115478
  • Title

    Phobos: a front-end approach to extensible compilers

  • Author

    Granicz, Adam ; Hickey, Jason

  • Author_Institution
    California Inst. of Technol., Pasadena, CA, USA
  • fYear
    2003
  • fDate
    6-9 Jan. 2003
  • Abstract
    This paper describes a practical approach for implementing domain-specific languages with extensible compilers. Given a compiler with one or more front-end languages, we introduce the idea of a "generic" front-end that allows the syntactic and semantic specification of domain-specific languages. Phobos, our generic front-end, offers modular language specification, allowing the programmer to define new syntax and semantics incrementally. A key feature of our approach is the use of an open term language that can be used to describe arbitrary syntax, and the use of a term rewriting engine to encode semantic actions. The term language is expressive. Scoping can be defined explicitly, and term rewrites use second-order substitution, allowing the use of higher-order abstract syntax if needed. Given a language specification and a source string, the generic front-end constructs a push-down automaton (PDA) based on the supplied grammar, lexes the source string, and simulates the constructed PDA with the stream of tokens obtained. During parsing, rewrite rules associated, with grammar productions are executed, producing a single term when the PDA accepts. This term is then converted, via further rewriting into a compiler representation and compilation proceeds to generate executable code.
  • Keywords
    computational linguistics; formal specification; high level languages; program compilers; rewriting systems; specification languages; Phobos; arbitrary syntax; domain-specific languages; executable code generation; extensible compilers; front-end languages; grammar; higher-order abstract syntax; modular language specification; open term language; parsing; push-down automaton; second-order substitution; semantic actions encoding; semantic specification; source string; syntactic specification; term rewriting engine; Automata; Computer languages; DSL; Domain specific languages; Engines; Formal languages; Joining processes; Production; Program processors; Programming profession;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    System Sciences, 2003. Proceedings of the 36th Annual Hawaii International Conference on
  • Print_ISBN
    0-7695-1874-5
  • Type

    conf

  • DOI
    10.1109/HICSS.2003.1174890
  • Filename
    1174890