
Hi, I'm creating my custom language add-on using Grammar Designer. My grammar requires these NonTerminals:
PrimaryExpression :
InvocationExpression
InvocationExpression :
PrimaryExpression ParenthesisOpen arguments ParenthesisClose
In xml grammar definition I write these rules like this:The problem is that when trying to generate semantic parser I get this error message:
Does this mean that parser for such type of grammar can't be automatically generated? Or is there a way I should rewrite production code to make it work with Grammar Designer?
Thank you,
Anton Filimonov
PrimaryExpression :
InvocationExpression
InvocationExpression :
PrimaryExpression ParenthesisOpen arguments ParenthesisClose
In xml grammar definition I write these rules like this:
<NonTerminal Key="PrimaryExpression" Parameters="out PrimaryExpression pr">
<Production>
<![CDATA[
<%pr = null;%>
("InvocationExpression<@out pr@>")
<%pr.EndOffset = this.Token.EndOffset;%>
]]>
</Production>
</NonTerminal>
<NonTerminal Key="InvocationExpression" Parameters="out InvocationExpression expr">
<Production>
<![CDATA[
<%
PrimaryExpression pr;
ArrayList args;
expr = null;
%>
"PrimaryExpression<@out pr@>"
'ParenthesisOpen'
"Arguments<@out args@>"
'ParenthesisClose'
<%
expr = new InvocationExpression();
expr.Primary = pr;
expr.Arguments = args
%>
]]>
</Production>
</NonTerminal>
Quote:
A parser generator exception occured:
Production PrimaryStatement allows for infinite left recursion
Does this mean that parser for such type of grammar can't be automatically generated? Or is there a way I should rewrite production code to make it work with Grammar Designer?
Thank you,
Anton Filimonov