How to understand cli output

In the following stdout,

what does → mean
and the · afterwards.

I need to understand where to put the marker in my grammar, not just trying until it works.

thank you.

shift/reduce conflict between
(sp | br)+ → · br
and
expression → LogicalExpression
With input:
LogicalExpression · br …
Shared origin: (br | sp | expression)+ → · expression
via expression → · LogicalExpressionBlock
via LogicalExpressionBlock → LogicalExpression · (sp | br)+ “{” “}”
(sp | br)+ → · br

A → B indicates a rule for term A containing expression B. The middle dot indicates a position inside that rule, so if it is at the end that position indicates a state where the parser has matched the expression but not yet reduced the term.

At a glance, the error looks like you have explicit whitespace matching in your grammar and, maybe, it can match in multiple ways (at the end of a logical expression block or at the start of something coming after that)?

2 Likes

@marijn Thank you, that clears things up. and yes, I use explicit whitespace and it’s not working very well, I think I’ll skip it and think of a different syntax.

Is there a tool to generate syntax diagram for my grammar ?

No. What kind of syntax diagram are you thinking of?

The traditional diagram, similar to this
https://chevrotain.io/playground/
https://www.xanthir.com/etc/railroad-diagrams/generator.html

No, nothing like that exists. (But also, that’s close enough to the format of the production rules to not really clarify a lot that isn’t already clear when reading the rules.)