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: 135
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 online Christian DietrichFriend
Messages: 14286
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:
Twitter : @chrdietrich
Blog :
Previous Topic:Xtext validation
Next Topic:content assist
Goto Forum:

Current Time: Sat Jul 02 18:34:51 GMT 2022

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

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

Back to the top