-
I'm working on a grammar for structured text language (PLC programming).
Each case can be defined by:
Each case can have 1 or many statements. For simplicity, a statement can be a I'm following a specification of EBNF rules describing this language. My grammar looks like this:
I understand that the problem is when I enter the I'm stuck and don't know how to get it running. I'm looking for any kind of advice. I was able to get it running in chevrotain using the lookahead condition in a rule gate, but I don't know how to do it with langium and was not able to find anything. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @rempAut, Langium barely exposes any internals of it using Chevrotain, so that makes the Another way, which would be way easier, is to create a special identifier token which is only able to match identifiers within case elements:
Note that your current grammar generates quite a malformed AST. You should use more assignments, as multiple unassigned subrule calls like you're currently doing (such as in |
Beta Was this translation helpful? Give feedback.
Hey @rempAut,
Langium barely exposes any internals of it using Chevrotain, so that makes the
GATE
approach quite difficult to use. In theory it's still possible, but you would have to basically copy all of the generic internal parser code (see here) to create your own parser and modify parts in order to support the gate statements.Another way, which would be way easier, is to create a special identifier token which is only able to match identifiers within case elements: