Seeking a sanity check - embedded newlines #4847
Unanswered
The-Futurist
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to define the basis for a grammar in which statements are terminated by either Newline or Semicolon yet at the same time tolerate (perhaps multiple adjacent) embedded Newline characters (like what Julia does for example).
I got something that works but want to get an opinion by people with more grammar/Antlr expertise. This is the grammar for a trivial "language" just to test the parsing strategy. (this has been through several iterations and refinements recently).
and this is a sample input (very simple language, just to test the parsing)
as you can see embedded newlines are defined by the rule "newlines" and I can insert this between the terms of each grammar rule as I see fit. The
statement_separatoris defined to be any mix of Newline/Semicolon and consumes any number of these it finds (to prevent them being seen at the start of a next statement).But:
Beta Was this translation helpful? Give feedback.
All reactions