Help with optional values in grammar #401
Unanswered
dirodriguezm
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
-
I'm trying to parse a SQL like language and I can't find a way to define the grammar for a "column reference".
The strings I'm trying to parse look like "catalog.schema.table.column" or could be just "column" or "table.column" or even "schema.table.column".
So for that kind of input, the grammar is defined like this in BNF:
What I've tried so far is this:
But with that, I can only successfully parse "a" or "a.b.c.d".
What could I do to fix this ? The only alternate solution I've come with is to put each item (catalog, schema, table and column) in an array, but that kind of breaks the original grammar.
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions