Skip to main content

Lund University Publications

LUND UNIVERSITY LIBRARIES

JastAdd - a Java-based system for implementing front ends

Hedin, Görel LU orcid and Magnusson, Eva LU (2001) 44(2). p.59-78
Abstract
We describe JastAdd, a Java-based system for specifying and implementing the parts of compiler front ends that follow parsing. The system is built on top of a traditional Java parser generator which is used for parsing and tree building. JastAdd adds facilities for specifying and generating object-oriented abstract syntax trees with both declarative behavior (using Reference Attributed Grammars (RAGs)) and imperative behavior (using ordinary Java code). The behavior can be modularized into different aspects, e.g. name analysis, type checking, code generation, etc., that are woven together into classes. The class weaving technique has many advantages over the often used Visitor pattern in that it provides a safe and much simpler interface... (More)
We describe JastAdd, a Java-based system for specifying and implementing the parts of compiler front ends that follow parsing. The system is built on top of a traditional Java parser generator which is used for parsing and tree building. JastAdd adds facilities for specifying and generating object-oriented abstract syntax trees with both declarative behavior (using Reference Attributed Grammars (RAGs)) and imperative behavior (using ordinary Java code). The behavior can be modularized into different aspects, e.g. name analysis, type checking, code generation, etc., that are woven together into classes. The class weaving technique has many advantages over the often used Visitor pattern in that it provides a safe and much simpler interface for many applications and in that it supports modularization of not only methods, but also data. Class weaving is also easy and useful to combine with Visitor techniques in order to achieve the best of both. We also describe the implementation of the RAG evaluator (optimal recursive evaluation) which is implemented very conveniently using Java classes, interfaces, and virtual methods. (Less)
Please use this url to cite or link to this publication:
author
and
organization
publishing date
type
Chapter in Book/Report/Conference proceeding
publication status
published
subject
host publication
Electronic Notes in Theoretical Computer Science
volume
44
issue
2
pages
59 - 78
publisher
Elsevier
external identifiers
  • scopus:18444385248
language
English
LU publication?
yes
id
5b9ff869-409c-49b6-9f59-fbcd471cd059 (old id 525772)
date added to LUP
2016-04-04 10:56:58
date last changed
2022-01-29 21:04:00
@inproceedings{5b9ff869-409c-49b6-9f59-fbcd471cd059,
  abstract     = {{We describe JastAdd, a Java-based system for specifying and implementing the parts of compiler front ends that follow parsing. The system is built on top of a traditional Java parser generator which is used for parsing and tree building. JastAdd adds facilities for specifying and generating object-oriented abstract syntax trees with both declarative behavior (using Reference Attributed Grammars (RAGs)) and imperative behavior (using ordinary Java code). The behavior can be modularized into different aspects, e.g. name analysis, type checking, code generation, etc., that are woven together into classes. The class weaving technique has many advantages over the often used Visitor pattern in that it provides a safe and much simpler interface for many applications and in that it supports modularization of not only methods, but also data. Class weaving is also easy and useful to combine with Visitor techniques in order to achieve the best of both. We also describe the implementation of the RAG evaluator (optimal recursive evaluation) which is implemented very conveniently using Java classes, interfaces, and virtual methods.}},
  author       = {{Hedin, Görel and Magnusson, Eva}},
  booktitle    = {{Electronic Notes in Theoretical Computer Science}},
  language     = {{eng}},
  number       = {{2}},
  pages        = {{59--78}},
  publisher    = {{Elsevier}},
  title        = {{JastAdd - a Java-based system for implementing front ends}},
  volume       = {{44}},
  year         = {{2001}},
}