2011-05-01
The Rascal Language Workbench
Publication
Publication
Rascal is a programming language for source code analysis and transformation. This means
that typically the input of a Rascal program is a program in some programming language, and
the output is often yet another program. So Rascal is a meta programming language. Source code
is thus primary object of manipulation in Rascal.
Many of the use cases that Rascal is designed to address, follow the Extract-Analyze-
SYnthesize, or EASY paradigm (shown in Figure 1.1). Meta programs often start by extracting
information (facts) from the input program. This is the extraction phase. An example could
be the call-graph of a program. Then, this extracted information is often subject to analysis:
derived facts are computed, the information is enriched. For the call graph, a simple analysis
is determining the root or leaf routines in the a source program by analysing the extracted
call-graph. Another analysis could be concerned by identifying routines that are never called
(dead code). Finally, the meta program will synthesize some kind of result. This can be transformed
source code (e.g., removal of dead code from the input program), a report (e.g., statistics
on the number of root and leaf routines), or a visualization (e.g., a graphical depiction of the
call-graph). Of course, these phases are not strictly sequential: there may be feedback loops.
Some analysis leads to new extraction, synthesis of a result may lead to new analyses and so
on. Rascal has elaborated features to support each of the phases of the EASY paradigm fully
integrated in the language.
Naturally, the implementation of domain specific languages (DSLs), or more generally, modeldriven
engineering (MDE) fits the EASY paradigm very well. When implementing a DSL compiler
or interpreter the input is, of course, DSL source code. Extraction could, for instance,
include the derivation of an AST from the concrete syntax tree. Another extracted model could
be a graph-like structure representing the input in a more abstract way, or a performance model.
Such abstractions are input to analyses such as constraint checking or type checking, verification,
quality-of-service analysis etc. Finally, synthesis covers tasks such as graphical visualization,
code generation, and optimization. To conclude, in the context of Rascal, we see DSL implementation
as an instance of source code analysis and transformation.
Additional Metadata | |
---|---|
CWI | |
Software Engineering [SEN] | |
Domain Specific Languages: A Big Future for Small Programs | |
Organisation | Software Analysis and Transformation |
van der Storm, T. (2011). The Rascal Language Workbench. Software Engineering [SEN]. CWI. |