dabeaz / sly

Sly Lex Yacc
Other
816 stars 107 forks source link

How to enable EBNF support? #82

Closed Morphlng closed 2 years ago

Morphlng commented 2 years ago

I want to write lox using Sly. The grammar given in the appendix is a EBNF grammar, and I saw the given calc.py EBNF example, but it doesn't run at all.

That code will prompt me an error: Symbol 'PLUS|MINUS' used, but not defined as a token or a rule

Maybe I have to enable the EBNF support manually?

jpsnyder commented 2 years ago

The | operator doesn't seem to be working. I suggest just making multiple productions

dabeaz commented 2 years ago

There's nothing to enable, but I'm not sure that feature is available in the last official "release." You'd need to try it with the latest in-progress coding by cloning directly from GitHub.

Morphlng commented 2 years ago

There's nothing to enable, but I'm not sure that feature is available in the last official "release." You'd need to try it with the latest in-progress coding by cloning directly from GitHub.

The {} and [] symbol works, but the | doesn't, so it could be the latest release's problem. Thanks