Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Expression Parser(Parsing expression to generate C code)
Expression Parser [message #1770233] Wed, 09 August 2017 05:34 Go to next message
Eclipse UserFriend
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 05:49 Go to previous message
Eclipse UserFriend
Hi, i dont understand this.
xtext already gives you an ast of what it has parsed
Previous Topic:Xtext validation
Next Topic:content assist
Goto Forum:
  


Current Time: Thu Jul 10 00:32:25 EDT 2025

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

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

Back to the top