haasn / -g-pl

/g/ programming language
13 stars 2 forks source link

Parsing diagram #20

Open graydude opened 12 years ago

graydude commented 12 years ago

I just realized that I followed a course about formal languages last year. They didn't teach us about individual implementations though, so I've been reading up on EBNF a bit. I came across a little tool to make a diagram out of a EBNF grammar, so I ran it on parsing.txt. However, the script used a slightly different syntax than normal EBNF (no ?'s, white space instead of commas for separation) so I had to rewrite it a bit. Could someone check if /parsing.png is right?

haasn commented 12 years ago

A few issues:

It sounds like your program uses a further variant of EBNF, but not the official, correct version.

Either way, I need to re-do the EBNF from scratch sooner or later because the whitespace is a bit wonky at the moment which can lead to some unexpected results. (I also just commited a change)

graydude commented 12 years ago

The first path of functionexpression should literally be “fullexpression except for literal”. That's what the - operator in EBNF does.

Yeah, I know. The script didn't understand that. I may re-do it and just replace fullexpression - literal by tierlist, functionapplication, functioncreation, block, etc.

stringcharacter is wrong, it should be “all characters except backslash and quotes”, and the alternatives should be a literal \, that is, two backslashes, or a literal \", that is, a backslash followed by a quote.

Thanks, I couldn't quite make out what that was supposed to be. There were some escaping issues.

stringcharacter is wrong, it should be “all characters except backslash and quotes”, and the alternatives should be a literal \, that is, two backslashes, or a literal \", that is, a backslash followed by a quote.

Also some escaping issues here.

haasn commented 12 years ago

Yeah, courtesy of github apparently. Good thing I wrote it out in words.