Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
research:dsal:aspectlisa [2009/02/19 13:39] – jfabry | research:dsal:aspectlisa [2009/02/19 14:23] (current) – jfabry | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== AspectLISA ===== | ||
+ | (Internal classification: | ||
+ | |||
+ | Reference paper: **" | ||
+ | |||
+ | The reference paper discusses both [[AspectG]] and AspectLISA | ||
+ | |||
+ | ===== Domain of the language ===== | ||
+ | |||
+ | The definition of programming languages (grammars) and compiler construction. An important problem in this area is the modularity, reusability and extensibility of a language specification. AOSD is used here to modularize semantic concerns that crosscut many language components described in the grammar. | ||
+ | |||
+ | From the reference paper: " | ||
+ | |||
+ | LISA is compiler-compiler that generates a language compiler and a set of related tools starting from an attribute grammar-based language specification. This specification is programmed in the LISA language: a DSL " | ||
+ | |||
+ | ===== Intent of the language ===== | ||
+ | |||
+ | The intent of AspectLISA, an extension to LISA, is to allow modularisation of concerns which are hard to implement using inheritance due to their cross-cutting nature. Examples of this are type checking, environment propagation and code generation. | ||
+ | |||
+ | Comparing AspectLISA and [[AspectG]] in one line: AspectLISA allows for extension of the base language, [[AspectG]] allows for the definition of new tools on an existing grammar. | ||
+ | |||
+ | ===== Join Point Model and Advice Model ===== | ||
+ | * JPM: Domain-Specific : Join points in AspectLISA are the production rules of the language specification. | ||
+ | * AM: Domain-Specific | ||
+ | |||
+ | Note that it could be vaguely argued that the advice model is general-purpose with respect to the base language, as it is the same kind of code that is written in the base language. | ||
+ | |||
+ | ===== Anatomy of the language ===== | ||
+ | |||
+ | AspectLISA pointcuts match rules or productions in the language specification. Two kinds of wildcards may be used here: | ||
+ | * " | ||
+ | * " | ||
+ | |||
+ | Advice are similar to templates in attribute grammars: " | ||
+ | |||
+ | The order of application of semantic rules is determined by the AspectLISA compiler, therefore there is no specification of before or after, and neither is there a need for aspect ordering to be defined. | ||
+ | |||
+ | ===== Typical Example ===== | ||
+ | |||
+ | These examples are taken from the 2006 paper with the same name as the reference paper((**" | ||
+ | |||
+ | As the base language: LISA is a DSL, we first include an example of code in LISA. The same example is used in [[AspectG]]. | ||
+ | |||
+ | language Robot { | ||
+ | lexicon { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | rule start { | ||
+ | START ::= begin COMMANDS end compute { | ||
+ | START.outp = COMMANDS.outp; | ||
+ | COMMANDS.inp = new Point(0, 0); }; | ||
+ | } | ||
+ | rule move { // each command changes one coordinate | ||
+ | | ||
+ | COMMAND.outp = new Point((COMMAND.inp).x-1, | ||
+ | | ||
+ | COMMAND.outp = new Point((COMMAND.inp).x+1, | ||
+ | | ||
+ | COMMAND.outp = new Point((COMMAND.inp).x, | ||
+ | | ||
+ | COMMAND.outp = new Point((COMMAND.inp).x, | ||
+ | } [...] } | ||
+ | |||
+ | |||
+ | The following code uses a pointcut that matches all productions with COMMAND as the left-hand non-terminal, | ||
+ | |||
+ | pointcut Time< | ||
+ | advice TimeSemantics< | ||
+ | |||
+ | |||
+ | ===== Enforced Restrictions ===== | ||
+ | |||
+ | AspectLISA is only able to add extra semantics to an existing language specification. It is not specified whether the semantic rules in the advice are restricted in any form. | ||
+ | |||
+ | ===== Implementation description ===== | ||
+ | |||
+ | The aspect weaver for AspectLISA is an integral part of the LISA compiler, taking place after its parsing phase. The algorithm for weaving merges the semantic rules for each advice with the production rules of the language before generating the compiler and/or language tools. The algorithm is outlined in the reference paper. |