4 comments

[ 3.8 ms ] story [ 22.3 ms ] thread
Interesting.

How to specify in a grammar that a double quote, " , should appear somewhere in the input?

Author here: That is indeed not possible. One would expect that using "\"" would define a literal for a double quote, but the parser does not interpret the back-slash and instead expect \" in the input. Please note that this online interactive parser is not intended to support all kind of lexical elements that occur in various programming languages. Please follow the pointers to IParse and RawParser for solutions that offer more possibilities.
You might also like the nearley playground, which lets you write a grammar in BNF and see all possible parsings of an input. You can even press a button and generate a random string that matches your grammar! https://omrelli.ug/nearley-playground/
Nice! I will add a link in my presentation for the workshop.