Skip to content
Discussion options

You must be logged in to vote

Hey @antoinelilly, thanks for trying out Langium :)

When trying to parse the (import=[Import:ID] ".")? refclass=[Class:ID]) part of your grammar, the underlying parser of Langium doesn't know about the semantic meaning of those references. All it sees are: (ID '.')? ID. When trying to decide whether it should parse the (ID '.')? part, the parser will need to look at the next few tokens to see whether that's a valid option. It sees [ID, '.'] in the stack and decides to parse the optional part, even though there isn't enough left afterwards to parse the rest of the parser rule successfully.

What you've just created is called a parser ambiguity since the part after the optional element looks…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by antoinelilly
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants