Help with SemanticParser

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by Gil Milow
Version: 4.0.0274
I have been trying to create my own JavaScript implementation based on the Simple Language AddOn. The reason I am not using the Dynamic JS implementation that comes with the product is that I want to have the "red wavy lines" show up for bad syntax.

That said, I am having some trouble wrapping my head around the complexity of creating a Semantic language using the Grammar.xml.

My problem right now is that I am trying to allow simple function calls. For example:
I am trying to modify the NonTerminal "Statement" to support these function calls. What I thought I would do add a "FunctionAccessExpression" to "Statement". But since the Assignment statement already contains a reference to "Expression" the XML won't compile.

Can you guide me down the proper path for doing something like this?


Comments (1)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Gil,

Yes it sounds like you have a case of left recursion here. Generally there are two things you can do to work around these issues.

First, do some token lookahead via a peek operation to try and figure out if the expression is a start of an assignment or a function call. Then call the appropriate one.

Alternatively consume the common Expression like this:
...code for assignment continuation here...
| (
...code for function call here...

Hope that helps.

Actipro Software Support

The latest build of this product (v24.1.0) was released 5 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.