Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Help with simple grammar
icon5.gif  Help with simple grammar [message #985956] Fri, 16 November 2012 20:58 Go to next message
Andrew A is currently offline Andrew AFriend
Messages: 9
Registered: June 2012
Junior Member
I have a grammar:
Model: statements+=Statement*;
Statement: Var | Macro | WS;

Var: '{' '#' value=ID '}' ;
Macro: '#macro' '{' value=ID'}';

This parsed succesfull

but this not:

and this is not:

It seems to be that parser expects #macro (where #m or #mac)

I don't understand why. Could you help me, please?
Re: Help with simple grammar [message #985965 is a reply to message #985956] Fri, 16 November 2012 21:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13930
Registered: July 2009
Senior Member

the problem is: keywords are terminals. and the lexer that reads terminals eats as much as it can


Var: '{' '#' value=ID '}' ;

Macro: '#''macro' '{' value=ID'}';

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Re: Help with simple grammar [message #986097 is a reply to message #985956] Sun, 18 November 2012 19:22 Go to previous message
Martin Baker is currently offline Martin BakerFriend
Messages: 31
Registered: July 2009
I keep getting caught out with this type of issue. To help me think it through I created Example1 and Example2 on this page.

Previous Topic:Selection for a type system
Next Topic:terminal ID with prefix!
Goto Forum:

Current Time: Sun May 09 14:28:42 GMT 2021

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

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

Back to the top