Skip to content
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

make production ending semicolon optional #14

Closed
CrockAgile opened this issue Oct 30, 2017 · 9 comments
Closed

make production ending semicolon optional #14

CrockAgile opened this issue Oct 30, 2017 · 9 comments
Assignees
Projects
Milestone

Comments

@CrockAgile
Copy link
Collaborator

Plenty of BNF examples, including the wikipedia example, do not require productions to terminate with a semicolon, but rather only require a newline. I believe the parser could be updated to optionally use the ending semicolon, which would support both formats.

@shnewto
Copy link
Owner

shnewto commented Oct 30, 2017

Yeah I've been thinking about this one too. Thanks for raising it.

@shnewto
Copy link
Owner

shnewto commented Oct 30, 2017

One note, I'd like it if we didn't require a newline either so breaking up long productions or expressions across lines wouldn't prohibit parsing.

@CrockAgile
Copy link
Collaborator Author

Not requiring the newline seems trickier to me, but sounds like you have an idea. How would that work?

@shnewto
Copy link
Owner

shnewto commented Oct 30, 2017

@CrockAgile I've got a lot of faith in what we can get out of nom, I could be misguided but here's my general thought. Productions can end on a ; on eof or if with peek or some similar custom mechanism we are able to see that a <...> ::= is next in line. What do you think?

@CrockAgile
Copy link
Collaborator Author

@Snewt that seems reasonable to me. I still need to brush up on nom to know how it handles forward peeking, but you are probably right it is doable. I would guess it would improve usability with negligible impact on performance or code readability

@CrockAgile CrockAgile added this to the 0.2.0 milestone Oct 30, 2017
@CrockAgile CrockAgile added this to Ready to do in 0.2.0 via automation Oct 30, 2017
@shnewto shnewto self-assigned this Oct 31, 2017
@CrockAgile
Copy link
Collaborator Author

@Snewt Would it be too slick/hacky to sidestep this issue by honoring BNF comments? If BNF comments are from ; to the end of line, then essentially they become optional. And would support comments in the input string.

@shnewto shnewto moved this from Plan to Ready in 0.2.0 Nov 1, 2017
@shnewto shnewto moved this from Ready to In Progress in 0.2.0 Nov 1, 2017
@shnewto
Copy link
Owner

shnewto commented Nov 1, 2017

@CrockAgile I'm not sure that would really sidestep the issue as it stands. It could be that we add support for ; comments but as it is they are expected to only show up in specific instances.

@CrockAgile
Copy link
Collaborator Author

@Snewt Sounds good! I think I got confused anyway by glancing at the algol example in the history section on the wiki.

shnewto pushed a commit that referenced this issue Nov 1, 2017
@shnewto
Copy link
Owner

shnewto commented Nov 1, 2017

closed by 21338d3

0.2.0 automation moved this from In Progress to Done Nov 1, 2017
shnewto added a commit that referenced this issue Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
0.2.0
  
Done
Development

No branches or pull requests

2 participants