Grammar GCLangBuilder
ANTLR-generated HTML file from edu/toronto/cs/gclang/parser/gclang.g

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



Definition of tree parser GCLangBuilder, which is a subclass of TreeParser.

	
	
program
		:				 #( NAME atom initBlock rulesBlock ) 
		;
	
	
protected atom
		:	VARNAME 
		|	NUMBER 
		;
	
	
initBlock
		:				 #( INIT expression ) 
		;
	
	
rulesBlock
		:				 #( RULES ( guardedCommand  trans = trans.or (gCmd); )+ ) 
		;
	
	
expression
		:	(	atom 
			|					 #( OR expression expression ) 
			|					 #( AND expression expression ) 
			|					 #( NEG expression ) 
			|					 #( IMPLIES expression expression ) 
			|					 #( IFF expression expression ) 
			|					 #( EQ variable atom ) 
			|	TRUE 
			|	FALSE 
			) 
		;
	
	
guardedCommand
		:				 #( COL guard command ) 
		;
	
	
protected guard
		:	expression 
		;
	
	
command
		:	atomicCommand 
		|				 #( SEMI command command ) 
		|				 #( CHOICE command command ) 
		;
	
	
atomicCommand
		:	assign 
		|	skip 
		|	ite 
		;
	
	
assign
		:				 #( ASSIGNOP variable expression ) 
		|				 #( ASSIGNOPSPEC variable atom ) 
		;
	
	
skip
		:	SKIP 
		;
	
	
ite
		:				 #( IF expression #( ELSE command command ) ) 
		;
	
	
protected variable
		:	VARNAME 
		;
	
	
protected enumSet
		:	( atom )+ 
		;