grammar

%union {
	public Pointcut PointcutType;
	public string StringType;
	public LinkEndPoint LinkEndPointType;
	public int IntType;
}

/* TERMINALS */
%token ASPECT EQUAL ARROW COLON PORTSEPARATOR CALLBACKSEPARATOR 
%token LPAR RPAR COMMA COLON EVENTIDENTIFIER
%token <StringType> ID REGEXP STRING
%token <IntType> INTEGER

%type <PointcutType> pointcut_entry
%type <StringType> class //target
%type <LinkEndPointType> event_id method_id right


aa:		{ /* Empty AA */ }
	| pointcut_list ASPECT ID LPAR var_list RPAR COLON advice_rules
		{ /* Full AA */ }
	| ASPECT ID LPAR RPAR COLON advice_rules
		{ /* Pointcut-less AA */ }
	;

pointcut_list:
	pointcut_list pointcut_entry	{ /* adding the entry to definition */ }
	| pointcut_entry		{ /* adding the entry to definition */ }
	;

pointcut_entry:
	ID EQUAL REGEXP	{ /* lampe = light* */ }
	| ID EQUAL ID	{ /* lampe = light1 */ }
	;

var_list: { /* empty list */ }
	| var_list1 { /* found list */ }
	;

var_list1:
	var_list1 COMMA ID { /* ID defined */ }
	| ID { /* ID defined */ }
	;

advice_rules:	{ /* empty rules */ }
	| advice_rules ID COLON class properties	{ /* component creation*/ }
	| advice_rules event_id ARROW LPAR right RPAR	{ /* link creation */ }
	;

class:
	ID				{ /* class ID */ }
	| class PORTSEPARATOR ID	{ /* composed class name */ }
	;

properties:	{ /* empty */ }
	| LPAR list_of_properties RPAR { /* properties specified */ }
	;

list_of_properties:
	property { /* found one property */ }
	| list_of_properties COMMA property { /* found another property */ }
	;

property:
	ID EQUAL INTEGER	{ /* INT type property definition */ }
	| ID EQUAL STRING	{ /* STR type property definition */ }
	;

event_id:
	ID PORTSEPARATOR EVENTIDENTIFIER ID parameters { /* event identifier */ }
	;

parameters:	{ /* no callback */ }
	| CALLBACKSEPARATOR list_of_parameters { /* callbacks defined */ }

list_of_parameters:
	list_of_parameters ID	{ /* found a callback */ }
	| ID			{ /* found a callback */ }
	;

right:
	method_id { /* target method found */ }
	;

method_id:
	ID PORTSEPARATOR ID	{ /* method identifier */ }
	;

%%
  • grammar.txt
  • Last modified: 2011/10/11 13:21
  • by hourdin