A generator of efficient strongly typed abstract syntax trees in Java
نویسندگان
چکیده
Abstract syntax trees are a very common data-structure in language related tools. For example compilers, interpreters, documentation generators, and syntax-directed editors use them extensively to extract, transform, store and produce information that is key to their functionality. We present a Java back-end for ApiGen, a tool that generates implementations of abstract syntax trees. The generated code is characterized by strong typing combined with a generic interface and maximal sub-term sharing for memory efficiency and fast equality checking. The goal of this tool is to obtain safe and more efficient programming interfaces for abstract syntax trees. The contribution of this work is the combination of generating a strongly typed data-structure with maximal sub-term sharing in Java. Practical experience shows that this approach is beneficial for extremely large as well as smaller data types.
منابع مشابه
Generator of efficient strongly typed abstract syntax trees in Java
Abstract syntax trees are a very common data-structure in language related tools. For example compilers, interpreters, documentation generators, and syntax-directed editors use them extensively to extract, transform, store and produce information that is key to their functionality. We present a Java back-end for ApiGen, a tool that generates implementations of abstract syntax trees. The generat...
متن کاملDeclarative Syntax Tree Engineering Or, One Grammar to Rule Them All
Grammars for many parser generators not only specify a language’s syntax but also the corresponding syntax tree. Unfortunately, most parser generators pick a somewhat arbitrary combination of features from the design space for syntax trees and thus lock in specific trade-offs between expressivity, safety, and performance. This paper discusses the three major axes of the design space—specificati...
متن کاملAutomized Generation of Typed Syntax Trees via XML
The XANTLR/TDOM project is an implementation of a “typed” XML[2] Document Object Model initially used to represent abstract syntax trees in a compiler project. Tree classes, SAX event receivers, visitor classes and DTD are automatically derived from a sparsely annotated ANTLR grammar. Mapping tag values onto the type system of the target language allows for the compilation of syntax, mostly yie...
متن کاملJastAdd - a Java-based system for implementing front ends
We describe JastAdd, a Java-based system for specifying and implementing the frontend parts of a compiler that follow parsing. The system is built on top of a traditional Java parser generator which is used for parsing and treebuilding. JastAdd adds facilities for specifying and generating object-oriented abstract syntax trees with both declarative behavior (using Reference Attributedsyntax tre...
متن کاملAnalysis through Reflection Walking the EMF model of BPEL4WS∗
The Eclipse modelling framework provides a hierarchy of Java classes that represent the abstract syntax of BPEL4WS. Many analyses of a BPEL4WS program boil down to walking its abstract syntax tree. We review, refine and extend a technique, based on Java’s reflection mechanism, to walk such trees. We apply this technique to implement two non-trivial analyses of BPEL4WS programs.
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2004