Weaving a debugging aspect into domain-specific language grammars

Hui Wu, Jeffrey G. Gray, Suman Roychoudhury, Marjan Mernik. Weaving a debugging aspect into domain-specific language grammars. In Hisham Haddad, Lorie M. Liebrock, Andrea Omicini, Roger L. Wainwright, editors, Proceedings of the 2005 ACM Symposium on Applied Computing (SAC), Santa Fe, New Mexico, USA, March 13-17, 2005. pages 1370-1374, ACM, 2005. [doi]

Abstract

A common trend in programming language specification is to generate various tools (e.g., compiler, editor, profiler, and debugger) from a grammar. In such a generative approach, it is desirable to have the definition of a programming language be modularized according to specific concerns specified in the grammar. However, it is often the case that the corresponding properties of the generated tools are scattered and tangled across the language specification. In this paper, separation of concerns within a programming language specification is demonstrated by considering debugging support within a domain-specific language (DSL). The paper first describes the use of AspectJ to weave the debugging semantics into the code created by a parser generator. The paper outlines several situations when the use of AspectJ is infeasible at separating language specification properties. To accommodate such situations, a second approach is presented that weaves the debugging support directly into a grammar specification using a program transformation engine. A case study for a simple DSL is presented to highlight the benefits of weaving across language specifications defined by grammars.