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 :
Model:
    (trains+=Train)*
    | (paths+=Path)*
    | (sections+=Section)*
;

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

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

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


But when I put this code at the Eclipse instance :

Section brestStBrieux :
    Start 0
    End 5
end

Section StBrieuxLeMan :
    Start 5
    End 10
end

Section leManParis :
    Start 1
    End 12
end

Path brestParis :
    Sections  { brestStBrieux, StBrieuxLeMan, leManParis}
end

Train tgv :
    Path  brestParis
    Speed  23
end


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: 14665
Registered: July 2009
Senior Member
Hi,

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)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: Thu Apr 25 13:06:11 GMT 2024

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

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

Back to the top