This is part of a grammar I'm working on as to develop a parser tool which will be important in doing my research. It gives me an error under ANTLR IDE In eclipse saying paraction, action, cspaction
are mutually left-recursive.
I've scanned the web for a solution but haven't understood how I might go about it. Since this language is a standard in research arena, I do not have the previledge of changing the semantic details of the language.
paraction : action | decl '\circspot' paraction;
action : schemaexp | command | INDEX | cspaction | action '['INDEX+ ':=' exp+']';
cspaction : 'Skip'|'Stop'|'Chaos'|comm '\circthen' action | pred '&' action
|action ';' action | action '\extchoice' action | action '\intchoice' action
|action '\lpar' nsexp | csexp | nsexp '\rpar' action
|action '\lpar' nsexp | nsexp '\rpar' action
|action '\\' csexp | paraction '('exp+')' | '\circmu' INDEX '\circspot' action
| ';' decl '\circspot' action | 'extchoice' decl '\circspot' action
| '\intchoice' decl '\circspot' action
| '\lpar' csexp '\rpar' decl '\circspot' '\lpar' nsexp '\rpar' '\circspot' action
| '\interleave' decl '\circspot' '\lpar' nsexp '\rpar' action;
I am actually trying to create a grammar file for 'Circus', which is a state rich formal modelling language which is a combination of a specification language called Z and a process modelling language called CSP(Communicating Sequential Process), so yes this is an existing language. Its used in academia for now since the language in under development. I have a EBNF of the language and I'm trying to translate the EBNF to grammar in ANTLR. i've managed to get the following two rules work. But cspaction
seems to be a difficult one.
paraction : (decl '\circspot' (paraction)+ | action) ;
action : ((schemaexp | command | N | cspaction)('[' IDENT+ ':=' exp+']')?)* ;
The backslashes are part of latex, which can be omitted for now since those are used as strings. Below pls find the full EBNF of Circus. Its from the published paper, A Denotational Semantics for Circus.
FULL EBNF of Circus - http://www.use.com/b1ad2df0609961615fff