Design patterns: elements of reusable object-oriented software
Design patterns: elements of reusable object-oriented software
ANTLR: a predicated-LL(k) parser generator
Software—Practice & Experience
Modern Compiler Implementation: In ML
Modern Compiler Implementation: In ML
Object-oriented tree traversal with J. J. Forester
Science of Computer Programming - Special issue: Language descriptions, tools and applications (LDTA'01)
Meta-programming with Concrete Object Syntax
GPCE '02 Proceedings of the 1st ACM SIGPLAN/SIGSOFT conference on Generative Programming and Component Engineering
Making compiler construction projects relevant to core curriculums
ITiCSE '05 Proceedings of the 10th annual SIGCSE conference on Innovation and technology in computer science education
Stratego/XT 0.16: components for transformation systems
Proceedings of the 2006 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
Tom: piggybacking rewriting on java
RTA'07 Proceedings of the 18th international conference on Term rewriting and applications
The ruby intermediate language
DLS '09 Proceedings of the 5th symposium on Dynamic languages
Hi-index | 0.00 |
Abstract Syntax Trees (ASTs) are commonly used to represent an input/output program in compilers and language processing tools. Many of the tasks of these tools consist in generating and rewriting ASTs. Such an approach can become tedious and hard to maintain for complex operations, namely program transformation, optimization, instrumentation, etc. On the other hand, concrete syntax provides a natural and simpler representation of programs, but it is not usually available as a direct feature of the aforementioned tools. We propose a simple technique to implement AST generation and rewriting in general purpose languages using concrete syntax. Our approach relies on extensions made in the scanner and the parser and the use of objects supporting partial parsing called Texts With Embedded Abstract Syntax Trees (TWEASTs). A compiler for a simple language (Tiger) written in C++ serves as an example, featuring transformations in concrete syntax: syntactic desugaring, optimization, code instrumentation such as bounds-checking, etc. Extensions of this technique to provide a full-fledged concrete-syntax rewriting framework are presented as well.