Grammar BASICParser
ANTLR-generated HTML file from snapshot/maverick/src/org/maverickdbms/tools/BASIC.g

Terence Parr, MageLang Institute
ANTLR Version 2.7.6 (2005-12-22); 1989-2005


Definition of parser BASICParser, which is a subclass of LLkParser.


abortst
	:	"ABORT" 
		(	expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
	|	"ABORTE" expression 
		(	COMMA expression 
		|	
		) 
	|	"ABORTM" 
		(	expression 
		|	
		) 
	;


expression
	:	ifExpression 
	;


arrayidentifier
	:	IDENT LPAREN expression ( COMMA expression )* RPAREN 
	;


protected branchStatementList
	:	(	statement ( SEMI 
				(	statement 
				|	
				) )* 
		|	( SEMI )* EOL 
			(	LABEL 
			|	
			) 
			( (	statement 
				|	
				) 
				(	SEMI 
				|	EOL 
				) 
				(	LABEL 
				|	
				) )* endst 
		) 
	;


statement
	:	(	abortst 
		|	breakst 
		|	callst 
		|	casest 
		|	chainst 
		|	clearst 
		|	clearcommonst 
		|	cleardatast 
		|	clearfilest 
		|	clearinputst 
		|	clearselectst 
		|	closest 
		|	closeseqst 
		|	convertst 
		|	commonst 
		|	continuest 
		|	crtst 
		|	datast 
		|	deffunst 
		|	delst 
		|	deletest 
		|	deletefilest 
		|	deletelistst 
		|	dimst 
		|	echost 
		|	equatest 
		|	executest 
		|	exitst 
		|	footingst 
		|	forst 
		|	formlistst 
		|	getlistst 
		|	gosubst 
		|	gotost 
		|	headingst 
		|	hushst 
		|	ifst 
		|	inputst 
		|	inputclearst 
		|	inst 
		|	insst 
		|	locatest 
		|	loopst 
		|	matst 
		|	matbuildst 
		|	matparsest 
		|	matreadst 
		|	matreadust 
		|	matwritest 
		|	napst 
		|	nullst 
		|	onst 
		|	openst 
		|	openseqst 
		|	osbreadst 
		|	osbwritest 
		|	osclosest 
		|	osopenst 
		|	osreadst 
		|	oswritest 
		|	pagest 
		|	pcperformst 
		|	performst 
		|	precisionst 
		|	printerst 
		|	printst 
		|	promptst 
		|	readst 
		|	readblkst 
		|	readfwdst 
		|	readlistst 
		|	readnext2st 
		|	readseqst 
		|	readust 
		|	readvst 
		|	readvust 
		|	releasest 
		|	removest 
		|	returnst 
		|	rqmst 
		|	seekst 
		|	selectst 
		|	setindexst 
		|	sleepst 
		|	stopst 
		|	writest 
		|	writeblkst 
		|	writelistst 
		|	writeseqst 
		|	writeseqfst 
		|	writeust 
		|	writevst 
		|	writevust 
		|	assignmentExpression 
		) 
	;


protected endst
	:	"END" 
	;


breakst
	:	"BREAK" 
		(	IDENT 
		|	
		) 
		(	"ON" 
		|	"OFF" 
		|	expression 
		) 
	;


protected callargs
	:	LPAREN 
		(	(	expression 
			|	"MAT" IDENT 
			) 
			( COMMA ( (	EOL 
					|	
					) ) 
				(	expression 
				|	"MAT" IDENT 
				) )* 
		|	
		) 
		RPAREN 
	;


callst
	:	"CALL" 
		(	AT 
			(	( IDENT 
					(	callargs 
						(	callargs 
						|	
						) 
					|	
					) 
					) 
			|	( STRING_LITERAL 
					(	callargs 
					|	
					) 
					) 
			) 
		|	(	MULT 
			|	
			) 
			IDENT 
			(	callargs 
			|	
			) 
			
		) 
	;


casest
	:	"BEGIN" "CASE" ( EOL )+ ( "CASE" expression 
			(	EOL 
			|	SEMI 
			) 
			statementList )* "END" "CASE" 
	;


protected statementList
	:	(	LABEL 
		|	
		) 
		(	statement 
		|	
		) 
		( (	SEMI 
			|	EOL 
			) 
			(	LABEL 
			|	
			) 
			(	statement 
			|	
			) )* 
	;


chainst
	:	"CHAIN" expression 
	;


clearst
	:	"CLEAR" 
	;


clearcommonst
	:	"CLEARCOMMON" 
		(	DIV IDENT DIV 
		|	
		) 
	;


cleardatast
	:	"CLEARDATA" 
	;


clearfilest
	:	"CLEARFILE" 
		(	identifier 
		|	
		) 
		(	onerrlockst 
		|	
		) 
	;


identifier
	:	IDENT 
		(	LPAREN expression ( COMMA expression )* RPAREN 
		|	
		) 
	;


protected onerrlockst
	:	( onerrorst 
			(	lockedst 
			|	
			) ) 
	|	lockedst 
	;


clearinputst
	:	"CLEARINPUT" 
	;


clearselectst
	:	"CLEARSELECT" 
		(	IDENT 
		|	NUMBER_LITERAL 
		|	
		) 
		
	;


closest
	:	"CLOSE" 
		(	identifier 
		|	
		) 
		(	onerrorst 
		|	
		) 
	;


protected onerrorst
	:	(	EOL 
		|	
		) 
		ON_ERROR branchStatementList 
	;


closeseqst
	:	"CLOSESEQ" expression 
		(	onerrorst 
		|	
		) 
	;


commonst
	:	(	"COM" 
		|	"COMMON" 
		) 
		(	DIV IDENT DIV 
		|	
		) 
		identifier ( COMMA ( (	EOL 
				|	
				) ) identifier )* 
	;


continuest
	:	"CONTINUE" 
	;


convertst
	:	"CONVERT" expression "TO" expression "IN" identifier 
	;


crtst
	:	"CRT" 
		(	printargs 
		|	
		) 
	;


protected printargs
	:	printexpr ( COMMA printexpr )* 
	;


datast
	:	"DATA" expression ( COMMA 
			(	EOL 
			|	
			) 
			expression )* 
	;


deffunst
	:	"DEFFUN" ( IDENT ) 
		(	LPAREN 
			(	(	"MAT" 
				|	
				) 
				IDENT ( COMMA 
					(	"MAT" 
					|	
					) 
					IDENT )* 
			|	
			) 
			RPAREN 
		|	
		) 
		(	"CALLING" expression 
		|	
		) 
		
	;


delst
	:	"DEL" identifier dynarrayargs 
	;


protected dynarrayargs
	:	LT concatExpression 
		(	COMMA concatExpression 
			(	COMMA concatExpression 
			|	
			) 
		|	
		) 
		GT 
	;


deletest
	:	"DELETE" expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


protected thenelsest
	:	(	EOL 
		|	
		) 
		(	( thenst 
				(	(	EOL 
					|	
					) 
					elsest 
				|	
				) ) 
		|	elsest 
		) 
	;


deletefilest
	:	"DELETEFILE" expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
	;


deletelistst
	:	"DELETELIST" expression 
	;


dimst
	:	"DIM" arrayidentifier ( COMMA arrayidentifier )* 
	;


concatExpression
	:	fmtExpression ( (	COLON 
			|	"CAT" 
			) 
			fmtExpression )* 
	;


echost
	:	"ECHO" 
		(	"ON" 
		|	"OFF" 
		|	expression 
		) 
	;


equatest
	:	(	"EQU" 
		|	"EQUATE" 
		) 
		( IDENT 
			(	"LITERALLY" 
			|	"LIT" 
			|	"TO" 
			) 
			expression ) ( COMMA IDENT 
			(	"LITERALLY" 
			|	"LIT" 
			|	"TO" 
			) 
			expression )* 
	;


executest
	:	"EXECUTE" expression 
		(	"PASSLIST" expression 
		|	
		) 
		(	"RTNLIST" identifier 
		|	
		) 
		(	"CAPTURING" identifier 
		|	
		) 
		(	"RETURNING" identifier 
		|	
		) 
	;


exitst
	:	"EXIT" 
	;


footingst
	:	"FOOTING" 
		(	"ON" multiplicativeExpression 
		|	
		) 
		expression 
	;


multiplicativeExpression
	:	exponentiveExpression ( (	MULT 
			|	DIV 
			) 
			exponentiveExpression )* 
	;


forst
	:	"FOR" identifier EQ expression "TO" expression 
		(	"STEP" expression 
		|	
		) 
		statementList ( (	"WHILE" 
			|	"UNTIL" 
			) 
			(	expression 
			|	readnextst 
			) 
			(	"DO" 
			|	
			) 
			statementList )* "NEXT" identifier 
	;


readnextst
	:	"READNEXT" expression 
		(	COMMA expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
		(	"FROM" 
			(	identifier 
			|	NUMBER_LITERAL 
			) 
		|	
		) 
		
	;


formlistst
	:	"FORMLIST" expression 
		(	"TO" 
			(	identifier 
			|	NUMBER_LITERAL 
			) 
		|	
		) 
		(	onerrorst 
		|	
		) 
		
	;


functionst
	:	"FUNCTION" IDENT 
		(	arglist 
		|	
		) 
		EOL 
	;


protected arglist
	:	LPAREN 
		(	arg 
		|	
		) 
		( COMMA arg )* RPAREN 
	;


getlistst
	:	"GETLIST" expression 
		(	"TO" 
			(	identifier 
			|	NUMBER_LITERAL 
			) 
		|	
		) 
		(	"SETTING" identifier 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


gosubst
	:	"GOSUB" 
		(	IDENT 
		|	NUMBER_LITERAL 
		|	DECIMAL_LITERAL 
		|	LABEL 
		) 
		(	COLON 
		|	
		) 
	;


gotost
	:	(	"GO" 
			(	"TO" 
			|	
			) 
		|	"GOTO" 
		) 
		(	IDENT 
		|	NUMBER_LITERAL 
		|	DECIMAL_LITERAL 
		|	LABEL 
		) 
		(	COLON 
		|	
		) 
	;


headingst
	:	"HEADING" 
		(	"ON" multiplicativeExpression 
		|	
		) 
		expression 
	;


hushst
	:	"HUSH" 
		(	"ON" 
		|	"OFF" 
		|	expression 
		) 
	;


ifst
	:	"IF" expression 
		(	thenelsest 
		|	
		) 
	;


inputclearst
	:	"INPUTCLEAR" 
	;


inputst
	:	"INPUT" identifier 
		(	COMMA inputargs 
		|	COLON 
		|	
		) 
		(	(	"FOR" 
			|	"WAITING" 
			) 
			expression 
		|	
		) 
		(	"UNFILTERED" 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


protected inputargs
	:	fmtExpression 
		(	( UNDERSCORE 
				(	COLON 
				|	
				) ) 
		|	( COLON 
				(	UNDERSCORE 
				|	
				) ) 
		|	
		) 
		
	;


fmtExpression
	:	additiveExpression 
		(	( substringExpression ) 
		|	( ) 
		) 
	;


inst
	:	"IN" identifier 
	;


insst
	:	"INS" expression "BEFORE" identifier dynarrayargs 
	;


locatest
	:	"LOCATE" 
		(	( expression "IN" identifier 
				(	dynarrayargs 
				|	
				) 
				(	COMMA expression 
				|	
				) 
				(	"BY" expression 
				|	
				) 
				"SETTING" identifier thenelsest ) 
		|	( LPAREN expression COMMA identifier 
				(	COMMA expression 
					(	COMMA expression 
						(	COMMA expression 
						|	
						) 
					|	
					) 
				|	
				) 
				SEMI identifier 
				(	SEMI expression 
				|	
				) 
				RPAREN thenelsest ) 
		) 
	;


loopst
	:	"LOOP" loopStatementList ( (	"WHILE" 
			|	"UNTIL" 
			) 
			(	expression 
			|	readnextst 
			) 
			(	"DO" 
			|	
			) 
			loopStatementList )* "REPEAT" 
	;


protected loopStatementList
	:	(	statement 
		|	
		) 
		( (	SEMI 
			|	EOL 
			) 
			(	LABEL 
			|	
			) 
			(	statement 
			|	
			) )* 
	;


matbuildst
	:	"MATBUILD" expression "FROM" IDENT 
		(	COMMA expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
		(	"USING" expression 
		|	
		) 
	;


matparsest
	:	"MATPARSE" IDENT 
		(	COMMA expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
		"FROM" expression 
		(	(	COMMA 
			|	"USING" 
			) 
			expression 
		|	
		) 
		(	"SETTING" identifier 
		|	
		) 
	;


matst
	:	"MAT" IDENT EQ 
		(	expression 
		|	"MAT" IDENT 
		) 
	;


matreadst
	:	"MATREAD" IDENT "FROM" expression 
		(	COMMA expression 
		|	
		) 
		onerrthenelsest 
	;


protected onerrthenelsest
	:	( onerrorst thenelsest ) 
	|	thenelsest 
	;


matreadust
	:	"MATREADU" IDENT "FROM" expression COMMA expression 
		(	COMMA expression 
		|	
		) 
		onerrlockthenelsest 
	;


protected onerrlockthenelsest
	:	( onerrorst lockthenelsest ) 
	|	lockthenelsest 
	;


matwritest
	:	"MATWRITE" IDENT 
		(	"ON" 
		|	"TO" 
		) 
		expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


napst
	:	"NAP" 
		(	expression 
		|	
		) 
		
	;


nullst
	:	"NULL" 
	;


openst
	:	"OPEN" expression 
		(	COMMA expression 
		|	
		) 
		(	"READONLY" 
		|	
		) 
		(	"TO" expression 
		|	
		) 
		onerrthenelsest 
	;


openseqst
	:	"OPENSEQ" expression 
		(	COMMA expression 
		|	
		) 
		(	"READONLY" 
		|	
		) 
		"TO" expression onerrlockthenelsest 
	;


osbreadst
	:	"OSBREAD" expression "FROM" identifier 
		(	"AT" expression 
		|	
		) 
		IDENT expression 
		(	"NODELAY" 
		|	
		) 
		(	onerrorst 
		|	
		) 
	;


osbwritest
	:	"OSBWRITE" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression 
		(	"AT" expression 
		|	
		) 
		(	"NODELAY" 
		|	
		) 
		(	onerrorst 
		|	
		) 
	;


osclosest
	:	"OSCLOSE" expression 
		(	onerrorst 
		|	
		) 
	;


osopenst
	:	"OSOPEN" expression 
		(	"READONLY" 
		|	"WRITEONLY" 
		|	
		) 
		"TO" expression 
		(	"NODELAY" 
		|	
		) 
		onerrthenelsest 
	;


osreadst
	:	"OSREAD" expression "FROM" expression onerrthenelsest 
	;


oswritest
	:	"OSWRITE" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression 
		(	onerrorst 
		|	
		) 
	;


onst
	:	"ON" expression 
		(	"GOSUB" 
		|	"GOTO" 
		|	"GO" 
		) 
		(	IDENT 
		|	NUMBER_LITERAL 
		|	DECIMAL_LITERAL 
		|	LABEL 
		) 
		(	COLON 
		|	
		) 
		( COMMA 
			(	EOL 
			|	SEMI 
			)* 
			(	IDENT 
			|	NUMBER_LITERAL 
			|	DECIMAL_LITERAL 
			|	LABEL 
			) 
			(	COLON 
			|	
			) )* 
	;


pagest
	:	"PAGE" 
		(	"ON" multiplicativeExpression 
		|	
		) 
		(	expression 
		|	
		) 
	;


pcperformst
	:	"PCPERFORM" expression 
		(	"CAPTURING" expression 
		|	
		) 
	;


performst
	:	"PERFORM" expression 
		(	"RTNLIST" expression 
		|	
		) 
		(	"CAPTURING" identifier 
		|	
		) 
		(	"RETURNING" identifier 
		|	
		) 
	;


precisionst
	:	"PRECISION" expression 
	;


printerst
	:	"PRINTER" 
		(	"CLOSE" 
			(	"ON" expression 
			|	
			) 
		|	"ON" 
		|	"OFF" 
		) 
	;


protected printexpr
	:	"IF" ifExpression "THEN" ifExpression "ELSE" printexpr 
	|	printexpr2 
	;


ifExpression
	:	( "IF" ifExpression "THEN" ifExpression "ELSE" ifExpression ) 
	|	logicalExpression 
	;


protected printexpr2
	:	printexpr3 ( (	AND 
			|	"AND" 
			|	OR 
			|	"OR" 
			) 
			printexpr3 )* 
	;


protected printexpr3
	:	printexpr4 ( (	GT 
				(	EQ 
				|	
				) 
			|	"GT" 
			|	GE 
			|	"GE" 
			|	LT 
			|	"LT" 
			|	LE 
			|	"LE" 
			|	NE 
			|	"NE" 
			|	EQ 
			|	"EQ" 
			|	"MATCH" 
			|	"MATCHES" 
			) 
			printexpr4 )* 
	;


protected printexpr4
	:	fmtExpression 
		(	COLON 
			(	fmtExpression 
			|	
			) 
			
		|	"CAT" fmtExpression 
		)* 
	;


printst
	:	"PRINT" 
		(	"ON" multiplicativeExpression 
		|	
		) 
		(	printargs 
		|	
		) 
	;


program
	:	(	( EOL )* functionst statementList 
		|	( EOL )* programst statementList 
		|	( EOL )* subroutinest statementList 
		|	statementList 
		) 
		(	endst ( EOL )* 
		|	
		) 
		EOF 
	;


programst
	:	"PROGRAM" IDENT EOL 
	;


subroutinest
	:	"SUBROUTINE" IDENT 
		(	arglist 
		|	
		) 
		EOL 
	;


promptst
	:	"PROMPT" expression 
	;


readst
	:	"READ" identifier "FROM" expression 
		(	COMMA expression 
		|	
		) 
		onerrthenelsest 
	;


readblkst
	:	"READBLK" identifier "FROM" expression COMMA expression 
		(	thenelsest 
		|	
		) 
	;


readfwdst
	:	"READFWD" expression "FROM" expression onerrlockthenelsest 
	;


readlistst
	:	"READLIST" expression 
		(	"FROM" 
			(	identifier 
			|	NUMBER_LITERAL 
			) 
		|	
		) 
		thenelsest 
	;


readnext2st
	:	readnextst onerrthenelsest 
	;


readseqst
	:	"READSEQ" identifier "FROM" expression onerrthenelsest 
	;


readust
	:	"READU" identifier "FROM" expression 
		(	COMMA expression 
		|	
		) 
		onerrlockthenelsest 
	;


readvst
	:	"READV" identifier "FROM" expression COMMA expression 
		(	COMMA expression 
		|	
		) 
		onerrthenelsest 
	;


readvust
	:	"READVU" identifier "FROM" expression COMMA expression 
		(	COMMA expression 
		|	
		) 
		onerrlockthenelsest 
	;


releasest
	:	"RELEASE" 
		(	expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
		(	onerrorst 
		|	
		) 
	;


removest
	:	"REMOVE" identifier "FROM" expression 
		(	"AT" identifier 
		|	
		) 
		"SETTING" identifier 
	;


returnst
	:	"RETURN" 
		(	expression 
		|	( "TO" 
				(	IDENT 
				|	NUMBER_LITERAL 
				|	DECIMAL_LITERAL 
				|	LABEL 
				) 
				(	COLON 
				|	
				) ) 
		|	
		) 
	;


rqmst
	:	"RQM" 
	;


seekst
	:	"SEEK" identifier 
		(	COMMA expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


selectst
	:	"SELECT" expression 
		(	"TO" 
			(	identifier 
			|	NUMBER_LITERAL 
			) 
		|	
		) 
		
		(	onerrorst 
		|	
		) 
	;


setindexst
	:	"SETINDEX" expression 
		(	COMMA expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
		(	"ON" identifier 
		|	
		) 
	;


sleepst
	:	"SLEEP" 
		(	expression 
		|	
		) 
		
	;


stopst
	:	"STOP" 
		(	expression 
			(	COMMA expression 
			|	
			) 
		|	
		) 
	|	"STOPE" expression 
		(	COMMA expression 
		|	
		) 
	|	"STOPM" 
		(	expression 
		|	
		) 
	;


writest
	:	"WRITE" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


writeblkst
	:	"WRITEBLK" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression 
		(	thenelsest 
		|	
		) 
	;


writelistst
	:	"WRITELIST" expression ( "ON" ) expression 
	;


writeseqst
	:	"WRITESEQ" expression 
		(	"APPEND" 
		|	
		) 
		(	"ON" 
		|	"TO" 
		) 
		expression onerrthenelsest 
	;


writeseqfst
	:	"WRITESEQF" expression 
		(	"APPEND" 
		|	
		) 
		(	"ON" 
		|	"TO" 
		) 
		expression onerrthenelsest 
	;


writeust
	:	"WRITEU" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


writevst
	:	"WRITEV" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression COMMA expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


writevust
	:	"WRITEVU" expression 
		(	"ON" 
		|	"TO" 
		) 
		expression COMMA expression 
		(	COMMA expression 
		|	
		) 
		(	onerrlockst 
		|	
		) 
		(	thenelsest 
		|	
		) 
	;


/**     Expressions
 *    Order of precedence(from least to first):
 *      IF 
 *    	& | 
 *    	= > < >= <= #> #< >< <> # MATCH
 *    	: CAT
 *      FMT
 *    	- +
 *    	* /
 *    	^ **
 *      [ ]
 *      < >
 *    	(function call)
 */
assignmentExpression
	:	( ( identifier ) dynarrayargs 
			(	( EQ ( expression ) ) 
			|	( COLON_ASSIGN ( ifExpression ) ) 
			|	( MINUS_ASSIGN ( ifExpression ) ) 
			|	( PLUS_ASSIGN ( ifExpression ) ) 
			) 
			) 
	|	( (	AT 
			|	
			) 
			identifier ( LBRACK expression COMMA expression RBRACK )* 
			(	(	EQ 
				|	COLON_ASSIGN 
				|	MINUS_ASSIGN 
				|	PLUS_ASSIGN 
				) 
				ifExpression 
			|	
			) ) 
	;


protected arg
	:	(	"MAT" 
		|	
		) 
		IDENT 
	;


protected elsest
	:	"ELSE" branchStatementList 
	;


protected lockedst
	:	(	EOL 
		|	
		) 
		"LOCKED" branchStatementList 
	;


protected lockthenelsest
	:	( lockedst thenelsest ) 
	|	thenelsest 
	;


protected thenst
	:	"THEN" branchStatementList 
	;


logicalExpression
	:	conditionalExpression ( (	OR 
			|	"OR" 
			|	AND 
			|	"AND" 
			) 
			conditionalExpression )* 
	;


conditionalExpression
	:	concatExpression ( (	GT 
				(	EQ 
				|	
				) 
			|	"GT" 
			|	GE 
			|	"GE" 
			|	LT 
			|	"LT" 
			|	LE 
			|	"LE" 
			|	NE 
			|	"NE" 
			|	EQ 
			|	"EQ" 
			|	"MATCH" 
			|	"MATCHES" 
			) 
			concatExpression )* 
	;


additiveExpression
	:	multiplicativeExpression ( (	PLUS 
			|	MINUS 
			) 
			multiplicativeExpression )* 
	;


substringExpression
	:	postfixExpression ( LBRACK expression COMMA expression RBRACK )* 
	;


exponentiveExpression
	:	unaryExpression ( ( POWER ) unaryExpression )* 
	;


unaryExpression
	:	MINUS substringExpression 
	|	PLUS substringExpression 
	|	substringExpression 
	;


postfixExpression
	:	primaryExpression 
		(	( dynarrayargs ) 
		|	( ) 
		) 
	;


primaryExpression
	:	( (	IDENT 
			|	"IN" 
			) 
			LPAREN 
			(	expression ( (	SEMI 
					|	COMMA 
					) 
					expression )* 
			|	
			) 
			RPAREN ) 
	|	AT IDENT 
	|	DECIMAL_LITERAL 
	|	EXPONENTIAL_LITERAL 
	|	NUMBER_LITERAL 
	|	STRING_LITERAL 
	|	LPAREN expression RPAREN 
	|	IDENT 
	;