-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grammar railroad diagram #126
Comments
I think all people starting to write a language start with bison/yacc/flex. Then they all arrive to the same conclusion; it doesn't really work nicely in that it becomes one big mess. A custom tokenizer with a handwritten parser is much easier and faster, so that's where they all end up :) What you a clickable EBNF have as advantage? |
|
yes, you are right, an EBNF grammar helps document the language and regarding C3, this is exactly the purpose as the compiler uses a custom lexer and parser written in C. C2 grammar is simpler so the EBNF should be shorter, and writing it may actually push for further syntax simplifications. |
If someone wants to give it a try, be my guest. I can put in online with the documenation. |
On https://github.com/c3lang/c3c/blob/master/resources/grammar/grammar.y they have a fully working grammar using bison/flex and that can be used to make a
C2lang
grammar.Another option is to use the
EBNF
generated from that grammar that can be understood by (IPV4) https://rr.red-dove.com/ui or (IPV6) https://www.bottlecaps.de/rr/ui to also trim down/expand to ac2lang
grammar with a nice navigable railroad diagram (see instructions bellow at the top).The text was updated successfully, but these errors were encountered: