[Newbie Q.] Grammar Failing: Element: -UNKNOWN- [message #1818401] |
Sat, 14 December 2019 13:28 |
Soulaymen Chouri Messages: 2 Registered: December 2019 |
Junior Member |
|
|
Hello everyone!
First of all, I would like to thank the amazing eclipse foundation for such an amazing tool. I have been trying to build a language for years, never felt like having the right tool to build something robust and productive.
I have started reworking on my old language using Xtext, just after finding out about this awesome tool!
Though I am having some trouble with the grammar, I am certain that I am misunderstanding something. Here is my grammar: (attached)
If I compile it, I get the following error: (attached)
However, if I change the rule
VarDeclExpr returns Expression :
'let' name=ID (':' type=Type)? '=' initialValue=Expression 'in' '{' innerBody=Expression '}'
;
to something like
VarDeclExpr returns Expression :
'var' name=ID (':' type=Type)? '=' initialValue=Expression 'in' '{' innerBody=Expression '}'
;
It works. I understand that at somepoint the parser wont know which rule to consider, a VarDeclExpr or VarDeclStatement., but there the 'in ...' after, so please any tip/advice would be appreciated!
I don't think I am having a left-recursive rule, since the IDE does not complain about my syntax even though it does not compile.
I am also still newbie about the Java Internals of the generated stuff, I still haven't got into it, and I did not modify anything.
Thanks!
-
Attachment: Mana.xtext
(Size: 3.29KB, Downloaded 43 times) -
Attachment: log.txt
(Size: 12.97KB, Downloaded 59 times)
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03647 seconds