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

Contents

Language Grammars

This is a collection of language descriptions. For each language, there are defined the abstract syntax and one concrete syntax. The abstract syntax definition language is oriented at the one used in [Mey90]. In the language, there are four kinds of grammar rules:

It is possible to refer to rules defined in other grammars to extend an existing language:

The concrete syntax definition language is used to write concrete syntax grammars for a previously defined abstract syntax. For one abstract syntax, different concrete syntaxes may exist. Composition works solely on the abstract syntax. Thus, fragments written in different concrete syntaxes can be composed. A concrete syntax grammar has a header line and rules oriented at EBNF rules [Int96].


Abstract Syntax Definition Language

Abstract syntax grammar

AbstractSyntax = rules:Rule+; 
 
Rule           = name:Identifier, definition:Definition?; 
 
Identifier     = identifier:S; 
 
Definition     = Aggregation | Choice; 
 
Choice         = options:Identifier+; 
 
Aggregation    = reference:Reference+; 
 
Reference      = name:Identifier, rule:Identifier, cardinality:Cardinality?; 
 
Cardinality    = PLUS | STAR | QUESTIONMARK; 
 
PLUS; 
STAR; 
QUESTIONMARK; 

Concrete syntax grammar

CONCRETESYNTAX as FOR abstractsyntax 
 
AbstractSyntax ::= rules+; 
 
Rule           ::= (name ("=" definition)? ";") | (definition "==>" name ";"); 
 
Identifier     ::= identifier[((’A’..’Z’|’a’..’z’|’0’..’9’)+ ’.’)?(’A’..’Z’|’a’..’z’|’0’..’9’)+]; 
 
Choice         ::= options ( "|" options)* ; 
 
Aggregation    ::= reference ( "," reference )*; 
 
Reference      ::= (name ":" rule cardinality?) ; 
 
PLUS           ::= "+"; 
STAR           ::= "*"; 
QUESTIONMARK   ::= "?"; 


Concrete Syntax Definition Language

Abstract syntax grammar

ConcreteSyntax   = name:S, languageName:S, superGrammar:S?, rules:Rule+; 
 
Rule             = name:Metaidentifier, definition:Choice; 
 
Metaidentifier   = identifier:S; 
 
Choice           = options:Aggregation+; 
 
Aggregation      = parts:SingleDefinition+; 
 
SingleDefinition = body:DefinitionBody, cardinality:Cardinality?; 
 
DefinitionBody   = SubDefinition | Reference | CsString; 
 
SubDefinition    = definition:Choice; 
 
Reference        = name:S, regex:S?; 
 
CsString         = value:S; 
 
Cardinality      = PLUS | STAR | QUESTIONMARK; 
 
PLUS; 
STAR; 
QUESTIONMARK;

Concrete syntax grammar

CONCRETESYNTAX cs FOR concretesyntax  
 
ConcreteSyntax   ::= "EBNF" name[((’A’..’Z’|’a’..’z’|’0’..’9’)+ ’.’ )?(’A’..’Z’|’a’..’z’|’0’..’9’)+] 
                     "FOR" languageName[((’A’..’Z’|’a’..’z’|’0’..’9’)+ ’.’ )? 
                                        (’A’..’Z’|’a’..’z’|’0’..’9’)+] 
                     "EXTENDS" superGrammar[((’A’..’Z’|’a’..’z’|’0’..’9’)+ ’.’ )? 
                                            (’A’..’Z’|’a’..’z’|’0’..’9’)+])? rules+; 
 
Rule             ::= name "::=" definition ";"; 
 
Metaidentifier   ::= identifier[((’A’..’Z’|’a’..’z’|’0’..’9’)+ ’.’ )? 
                                (’A’..’Z’|’a’..’z’|’0’..’9’)+]; 
 
Aggregation      ::= parts+; 
 
Choice           ::= options ("|" options)*; 
 
SingleDefinition ::= body cardinality?; 
 
Reference        ::= name[((’A’..’Z’|’a’..’z’|’0’..’9’)+ ’.’ )? (’A’..’Z’|’a’..’z’|’0’..’9’)+] 
                     regex[’[’ ( ’ ’|’(’|’)’|’|’|’?’|’*’|’+’|’~’|’.’| 
                           (’\’’ ( ~(’\’’|’\\’) | (’\\’ .))* ) ’\’’ )* ’]’]?; 
 
CsString         ::= value[(’\"’ (~’\"’)* ’\"’) | (’\’’ (~’\’’)* ’\’’)]; 
 
SubDefinition    ::= "(" definition ")"; 
 
PLUS ::= "+"; 
STAR ::= "*"; 
QUESTIONMARK ::= "?"; 



Bibliography

Retrieved from "http://reuseware.org/index.php/Language_Grammars"

This page has been accessed 390 times. This page was last modified 12:59, 11 January 2008.