Grammar ADLParser
ANTLR-generated HTML file from ADLParser.g

Terence Parr, MageLang Institute
ANTLR Version 2.7.1; 1989-1999

	
	
	package adl.parser;
	
	import adl.ast.*;
	import adl.ast.factory.ADLObjectFactory;
	
	import java.util.List;
	import java.util.ArrayList;
	
	

class ADLParser extends LLkParser


formulae[ArrayList theFormulae=null]
	:	( formula )* EOF 
	;


formula[ADLFormula theFormula = null]
	:	implicationFormula 
	;


protected implicationFormula[ADLFormula theFormula = null]
	:	orFormula ( IMP orFormula )* 
	;


protected orFormula[ADLFormula theFormula = null]
	:	andFormula ( OR andFormula )* 
	;


protected andFormula[ADLFormula theFormula = null]
	:	negationFormula ( AND negationFormula )* 
	;


protected negationFormula[ADLFormula theFormula = null]
	:	( NOT )* modalFormula 
	;


protected modalFormula[ADLFormula theFormula = null]
	:	simpleModalFormula 
	|	actionModalFormula 
	|	basicFormula 
	;


protected simpleModalFormula[ADLFormula theFormula = null]
	:	(	TK_K 
		|	TK_W 
		) 
		INDEX agent negationFormula 
	;


protected actionModalFormula[ADLFormula theFormula = null]
	:	(	( LBRACK action RBRACK ) 
		|	( LT action GT ) 
		) 
		INDEX agent negationFormula 
	;


protected basicFormula[ADLFormula theFormula = null]
	:	(	TK_TRUE 
		|	TK_true 
		) 
		
	|	(	TK_FALSE 
		|	TK_false 
		) 
		
	|	( LPAREN formula RPAREN ) 
	|	operatorFormula 
	|	propositionalVariable 
	;


agent[ADLAgent theAgent = null]
	:	IDENTIFIER 
	;


action[ADLAction theAction = null]
	:	unionAction 
	;


protected operatorFormula[ADLOperatorFormula theFormula = null]
	:	(	TK_A 
		|	TK_COMM 
		) 
		INDEX agent action 
	;


protected propositionalVariable[ADLPropositionalVariable variable = null]
	:	IDENTIFIER 
	;


protected unionAction[ADLAction theAction = null]
	:	sequenceAction ( CHOICE sequenceAction )* 
	;


protected sequenceAction[ADLAction theAction = null]
	:	starAction ( S_POS starAction )* 
	;


protected starAction[ADLAction theAction = null]
	:	operatorAction ( STAR )* 
	;


protected operatorAction[ADLAction theAction = null]
	:	basicAction 
	|	( (	TK_C 
			|	TK_U 
			) 
			operatorAction ) 
	;


protected basicAction[ADLAction theAction = null]
	:	( LPAREN action RPAREN ) 
	|	atomicAction 
	|	testAction 
	;


protected atomicAction[ADLAtomicAction theAction = null]
	:	IDENTIFIER 
	;


protected testAction[ADLTest theAction = null]
	:	TEST LPAREN formula RPAREN 
	;