Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Expression Parser(Parsing expression to generate C code)
Expression Parser [message #1770233] Wed, 09 August 2017 09:34 Go to next message
Virag Purnam is currently offline Virag PurnamFriend
Messages: 130
Registered: June 2014
Senior Member
In grammar for one of the field user can write expression as mentioned below.


isUsed = IF(<Condition>) THEN <True> ELSE <False>

In the generator part. We want to parse this and generate C code.
Can some body help me how to use antlr in this scenario?

Grammar is like :

Expression returns Expression:
OrExpression | IfThenElseExpression ;

OrExpression returns Expression:
AndExpression (=> ({BinaryOperation.left=current} feature=OpOr) right=OrExpression)*;

IfThenElseExpression returns Expression:
{IfThenElseExpression} 'IF' ifExpr=Expression 'THEN' thenExpr=Expression 'ELSE' elseExpr=Expression;

Re: Expression Parser [message #1770234 is a reply to message #1770233] Wed, 09 August 2017 09:49 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
Hi, i dont understand this.
xtext already gives you an ast of what it has parsed


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext validation
Next Topic:content assist
Goto Forum:
  


Current Time: Mon Sep 20 15:29:10 GMT 2021

Powered by FUDForum. Page generated in 0.01549 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top