paul-kline / bnf-playground

35 stars 7 forks source link

Support for epsilon? #1

Closed Enter-tainer closed 3 years ago

Enter-tainer commented 3 years ago

Hi, thanks for your great work! It helps me a lot.

I have some questions when using this editor. I don't know how can I use epsilon, i.e. the empty sequence. I've tried "null", "nil", "espilon", but they all don't compile.

paul-kline commented 3 years ago

excellent point. I think for now there is no way to explicitly have an epsilon. I will look into adding this feature.

paul-kline commented 3 years ago

Epsilon is now supported with the special symbol capital E. For example, <very> ::= E | "very" <very> matches zero or more "very"s in a row, such as veryveryvery.

WARNING: Be careful using the epsilon rule. You can easily cause an internal infinite loop that causes the page to become unresponsive. For example, if your BNF in any way simplifies to E*, compiling will cause an infinite loop and you will have to kill the page and lose any unsaved progress.