Skip to content

What is the difference between importing a langium grammar and just putting that grammar into your file? #1602

Answered by msujew
Austin-Fulbright asked this question in Q&A
Discussion options

You must be logged in to vote

I've put your grammar into the playground and simulated what happens when using grammar imports here. I've mentioned this in my earlier comment:

However, when importing a grammar, all imported terminal rules get put to the back of the list, and consequently get the lowest precedence.

Since terminals that appear later in the grammar get a lower precedence, the lexer and consequently the parser behave differently. Note that you can adjust the TokenBuilder instance to modify that behavior.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@msujew
Comment options

Answer selected by Austin-Fulbright
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