All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.antlr.v4.test.runtime.templates.FullContextParsing.LoopsSimulateTailRecursion.stg Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
/*
 * Tests predictions for the following case involving closures.
 * http://www.antlr.org/wiki/display/~admin/2011/12/29/Flaw+in+ANTLR+v3+LL(*)+analysis+algorithm
 */
TestType() ::= "Parser"

Options ::= [
	"Debug": true
]

Grammar ::= [
	"T": {}
]

Input() ::= "a(i)\<-x"

Rule() ::= "prog"

Output() ::= <<
pass: a(i)\<-x<\n>
>>

Errors() ::= <<
line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)'
line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)\<-x'<\n>
>>

grammar(grammarName) ::= <<
grammar ;
prog
@init {}
	: expr_or_assign*;
expr_or_assign
	: expr '++' {}
	|  expr {}
	;
expr: expr_primary ('\<-' ID)?;
expr_primary
	: '(' ID ')'
	| ID '(' ID ')'
	| ID
	;
ID  : [a-z]+ ;
>>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy