Posted 14 years ago
by Gary Ranson

Can somebody please help ...
I'm trying to implement a grammer to support the "member-access" syntax but I am failing miserably. I've remove the left recursion out from everywhere but this remains Non-Terminal.
This is a snippet from my grammar ....And you will see that the memberAccess production refers to primaryExpression - and therefore Left Recursion.
Is there someone who can please help me?
Regards,
Gary Ranson.
[Modified at 04/29/2011 07:02 AM]
[Modified at 04/29/2011 07:21 AM]
I'm trying to implement a grammer to support the "member-access" syntax but I am failing miserably. I've remove the left recursion out from everywhere but this remains Non-Terminal.
This is a snippet from my grammar ....
primaryExpression.Production = literal[Vx.Exp] > AstFrom(Vx.Exp)
| simpleName[Vx.Exp] > AstFrom(Vx.Exp)
| functionAccessMethod[Vx.Exp] > AstFrom(Vx.Exp)
| parenthesizedExpression[Vx.Exp] > AstChildFrom(Vx.Exp)
| memberAccess[Vx.Exp] > AstFrom(Vx.Exp)
/* | invocationExpression*/
;
/*
* simple-name: identifier
* */
simpleName.Production = identifier.ToTerm().ToProduction().SetLabel(Vx.Name)
> Ast("SimpleName", AstFrom(Vx.Name));
functionAccessMethod.Production = @identifier[Vx.Name] + @openParenthesis + argumentList[Vx.Args].Optional() + @closeParenthesis
> Ast("FunctionAccessExpression", AstFrom(Vx.Name), AstFrom(Vx.Args));
/*
* parenthesized-expression: ( expression )
*/
parenthesizedExpression.Production = @openParenthesis + expression[Vx.Exp] + @closeParenthesis
> Ast("ParenthesizedExpression", AstFrom(Vx.Exp));
/*
member-access: primary-expression . identifier
*/
memberAccess.Production = primaryExpression[Vx.Prefix] + @dotOperator + @identifier[Vx.Name]
> Ast("MemberAccess",AstFrom(Vx.Prefix), AstFrom(Vx.Name));
Is there someone who can please help me?
Regards,
Gary Ranson.
[Modified at 04/29/2011 07:02 AM]
[Modified at 04/29/2011 07:21 AM]