-
Notifications
You must be signed in to change notification settings - Fork 18k
x/exp/ebnf: wider support for EBNF grammars #17848
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
Comments
Do you have a strong reason for wanting to make these changes (besides being "standard compliant")? The package is tiny, you can always make a copy and adjust it for your purposes and post elsewhere. Once we try to follow the standard, there is going to be a maintenance burden, because there will be bugs. I'd prefer this would be left alone; as I don't see any benefit here. Specifically:
|
I was looking at how to define EBNF spec for a syntax I'm working on (https://github.com/bamarni/ticketfile), and maybe use x/exp/ebnf to validate the spec file during CI. I reported this as it could have been an improvement and possibly a first contribution. But if you think that's not worth the effort I'll probably stick to the golang spec style. |
It sounds like you are free to define the syntax however you like (i.e., the exact notation is not forced upon you through some external body). If that is indeed the case, I'd recommend that you just stick to the style used in the spec if you want to use this library. The point of EBNF is to make syntax easy to read, and our choice may not be the standard, but it's not uncommon, simple, and it's faithful to the original intent by the inventor N. Wirth (standards have a tendency to add unnecessary complexity). Instead, focus your energy on the rest of your product (just my recommendation). On the other hand, if you insist on following that particular standard for whatever reason, I suggest you just make a local copy. The library is really small, and then you have full control over it no matter what. In fact, this might be the best choice for you since x/exp is experimental and we're not giving any guarantees about its content or how long it might stay as is or even be around. Finally, if you're looking for a way to contribute, there's plenty of stuff to do that's interesting, and that would have more impact (because it's more important). A starting point is to look at open issues https://github.com/golang/go/issues and see if you can find something that you'd feel comfortable to tackle (search for the "suggested" label). More urgent issues can be found by looking for the Go 1.8 and Go 1.8 Maybe labels. |
At the moment, the x/exp/ebnf package implements a subset of EBNF specification and also has some golang specific syntax.
For example, the following would be parsed as valid while it is not strict EBNF :
And this one is valid EBNF but would be parsed as invalid :
Would you accept contributions to make it support more of the EBNF spec? Or does it only target the golang specification syntax?
Some ideas :
(* ... *)
? ... ?
;
The text was updated successfully, but these errors were encountered: