reuseLogoDevBooststLogo
gearsBG
Reuseware Composition Framework
Components, Modules, Aspects or something new?
Introduce new Composition Techniques into your Language of Choice with Reuseware!

Contents

Basic Composition Language Refernce

This is a reference of the basic composition language provided by FraCoLa. The language can be used in any invasive composition system to compose fragment components independent of the component language. The abstract and concrete syntax definitions of the language are described like all languages in the Reuseware Framework and can be found at the end of this article.


Composition Statement

A composition program is a sequence of composition statements. The following composition statements are available in the basic composition language:


Composer Statements

Composer statements are special composition statements that execute composition operators. The composition language includes such statements for the primitive composition operators.


Modularization and Composition

Composition programs are themselves composable. In particular, they may contain in-place bind operations that are especially applicable in composer definitions (see next section).

In-place binds are available for values, fragment names, fragment types, and variation point names.


Composer Definitions

The basic composition language contains a construct to define complex composers. For each composer defined, a construct to call the composer has to exist in a specialized composition language.

The arguments are accessible as fragments. Thus, they can be directly composed, meaning that the fragments passed to the composer are bound and extended with each other. However, often arguments configure the composer itself. In this case, they need to be bound in-place (e.g., one argument is the name of a slot the composer should address: bind ->slotNameArg on fragArg1 with fragArg2;).


Language Descriptions

Abstract syntax grammar

CompositionProgram       = statementList:CompositionStatementList; 
 
CompositionStatementList = statements:CompositionStatement*; 
 
CompositionStatement     = Composer | FragmentDeclaration | Print | Conditional | ForEachLoop | 
                           Traverse| Prune; 
 
FragmentDeclaration      = type:componentmodel.AbstractFragmentType, 
                           name:AbstractFragmentName, 
                           value:Value+;
 
componentmodel.AbstractFragmentType = FragmentTypeBind; 
FragmentTypeBind; 
FragmentTypeBind    ==> Bind; 
 
AbstractFragmentName  = FragmentName | FragmentNameBind; 
FragmentNameBind; 
FragmentNameBind    ==> Bind; 
FragmentName          = name:S, subFragment:AbstractFragmentName?, index:S?; 
 
Value                 = Location | AbstractFragmentName | FragmentDefinition | ValueBind; 
ValueBind; 
ValueBind           ==> Bind;
 
Location              = path:S; 
 
FragmentDefinition    = codePieces: CodePiece+, fileExtension:S; 
 
CodePiece             = ConcreteCodePiece | AbstractFragmentName | RandomPiece; 
ConcreteCodePiece     = code:S; 
RandomPiece; 
 
Print                 = fragment:AbstractFragmentName, location:Location; 
 
ForEachLoop           = fragmentName:AbstractFragmentName, 
                        list:AbstractFragmentName, 
                        body:CompositionStatementList; 
 
Traverse              = fragmentName:AbstractFragmentName, 
                        list:AbstractFragmentName, 
                        body:CompositionStatementList;
Prune; 
 
Conditional           = condition:ConcatenatedCondition, 
                        ifBody:CompositionStatementList,
                        elseBody:CompositionStatementList;
 
Condition             = InstanceofCondition | IsBoundCondition | EqualsCondition; 
 
ConcatenatedCondition = conditions:Condition+; 
 
InstanceofCondition   = fragment:AbstractFragmentName, 
                        type:componentmodel.AbstractFragmentType;
 
IsBoundCondition      = fragment:AbstractFragmentName, 
                        slot:componentmodel.AbstractVariationPointName; 
 
EqualsCondition       = fragment1:AbstractFragmentName, fragment2:AbstractFragmentName; 
 
VariationPointNameBind; 
VariationPointNameBind                  ==> Bind; 
componentmodel.AbstractVariationPointName = Bind;
 
Composer  = Bind | Extend | Prepend | Append; 
 
Bind      = slot:componentmodel.AbstractVariationPointName?, 
            fragment:AbstractFragmentName?, value:Value; 
 
Extend    = hook:componentmodel.AbstractVariationPointName?, 
            fragment:AbstractFragmentName?, value:Value+; 
 
Prepend; 
Prepend ==> Extend; 
Append; 
Append  ==> Extend;

Concrete syntax grammar

CONCRETESYNTAX fcp FOR compositionlanguage 
 
CompositionProgram       ::= "composition" "program" statementList; 
 
CompositionStatementList ::= statements*; 
 
FragmentDeclaration ::= "fragment" type name "=" value ("," value)* ";"; 
 
Location            ::= path[(’/’ (’A’..’Z’|’a’..’z’|’0’..’9’|’_’|’.’|’’)+)+]; 
 
FragmentDefinition  ::= codePieces (’+’ codePieces)* "."fileExtension[(’A’..’Z’|’a’..’z’|’_’) 
                        (’A’..’Z’|’a’..’z’|’_’|’0’..’9’)*]; 
 
ConcreteCodePiece   ::= code[ ’\’’ (~(’\’’))* ’\’’]; 
RandomPiece         ::= "?"; 
 
Bind    ::= "bind" (slot "on")? fragment "with" value ";"; 
 
Extend  ::= "extend" (hook "on")? fragment "with" value ("," value)* ";"; 
Prepend ::= "prepend" (hook "on")? fragment "with" value ";"; 
Append  ::= "append" (hook "on")? fragment "with" value ";"; 
 
Print   ::= "print" fragment "to" location ";"; 
 
ValueBind              ::= "->" value; 
FragmentNameBind       ::= "->" value; 
FragmentTypeBind       ::= "->" value; 
VariationPointNameBind ::= "->" value;
 
FragmentName ::= name[(’A’..’Z’|’a’..’z’|’_’)(’A’..’Z’|’a’..’z’|’_’|’0’..’9’)*] 
                 ("[" index[(’’)?(’0’..’9’)+] "]")? ("." subFragment)?; 
 
componentmodel.VariationPointName ::= name[(’A’..’Z’|’a’..’z’|’_’) 
                                      (’A’..’Z’|’a’..’z’|’_’|’0’..’9’)*]; 
componentmodel.FragmentType       ::= (language[(’A’..’Z’|’a’..’z’|’_’) 
                                      (’A’..’Z’|’a’..’z’|’_’|’0’..’9’)*] ".")? 
                                      construct[(’A’..’Z’|’a’..’z’|’_’) 
                                      (’A’..’Z’|’a’..’z’|’_’|’0’..’9’)*]; 
 
Conditional           ::= "if" "(" condition ")" "{" ifBody "}" ("else" "{" elseBody "}")?;
ConcatenatedCondition ::= conditions ("&&" conditions)*; 
 
InstanceofCondition   ::= fragment "instanceof" type; 
 
IsBoundCondition      ::= "isbound" slot "on" fragment; 
 
EqualsCondition       ::= fragment1 "equals" fragment2; 
 
ForEachLoop           ::= "foreach" "(" fragmentName ":" list ")" "{" body "}"; 
 
Traverse              ::= "traverse" "(" fragmentName ":" list ")" "{" body "}"; 
 
Prune                 ::= "prune" ";";

Retrieved from "http://www.emftext.org/index.php/Composition_language"

This page has been accessed 683 times. This page was last modified 13:55, 11 January 2008.