You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a parser for a subset of mermaid diagrams using BNFC.
One of the features of this language is that the lexer is context-dependent. See, for example, the following three diagrams:
Diagram 1:
stateDiagram-v2
s2 : This is a state description
Diagram 2:
stateDiagram-v2
s1 --> s2
Diagram 3:
stateDiagram-v2
s1 --> s2: A transition
The choice of whether s1 and s2 are an identifier or free text in this language is based on other tokens. For example, once you are in a state description (determined by seeing a state, and then seeing a ":" right after a state identifier), anything until the end of the line is a state description.
Activity
andreasabel commentedon Jan 13, 2025
Short answer: no.
BNFC is really only a wizard to generate parser definitions for yacc-like parser generators in a rather straightforward way.