Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext grammar : mismatched input '0' expecting RULE_INT
Xtext grammar : mismatched input '0' expecting RULE_INT [message #1676467] Sun, 15 March 2015 13:42 Go to next message
Mouad Bichouarine is currently offline Mouad BichouarineFriend
Messages: 1
Registered: March 2015
Junior Member

I'm new to Xtext and I'm trying to create a simple DSL for railway systems, here's my grammar :
    | (paths+=Path)*
    | (sections+=Section)*

    'Train' name=ID ':'
    'Path'  path=[Path]
    'Speed' speed=INT

    'Path'      name=ID ':'
    'Sections'  ('{' sections+=[Section] (',' sections+=[Section] )+ '}' ) | sections+=[Section]

    'Section'   name=ID ':'
    'Start'     start=INT
    'End'       end=INT
    ('SpeedMax' speedMax=INT)?

But when I put this code at the Eclipse instance :

Section brestStBrieux :
    Start 0
    End 5

Section StBrieuxLeMan :
    Start 5
    End 10

Section leManParis :
    Start 1
    End 12

Path brestParis :
    Sections  { brestStBrieux, StBrieuxLeMan, leManParis}

Train tgv :
    Path  brestParis
    Speed  23

I got this error three times:

mismatched input '0' expecting RULE_INT
mismatched input '1' expecting RULE_INT
mismatched input '5' expecting RULE_INT

I can't see where those errors come from, what can I do to fix them. Any idea?
Re: Xtext grammar : mismatched input '0' expecting RULE_INT [message #1679005 is a reply to message #1676467] Mon, 16 March 2015 12:34 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13876
Registered: July 2009
Senior Member

please post your complete grammar. this grammar works fine for me. please try it with a new project.

(there is an ambiguity problem in the grammar you should solve)

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Xtext 2.8.0 and Xtext Maven Plugin to generate the model artifacts
Next Topic:Initialization in Xtext Validation
Goto Forum:

Current Time: Sat Apr 10 20:23:32 GMT 2021

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

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

Back to the top