BNF grammar for VRL #632
cdepillabout
started this conversation in
General
Replies: 1 comment
-
No, there isn't any. We are aware of inconsistencies in whitespace and newline handling. The parser is here: https://github.com/vectordotdev/vrl/blob/main/src/parser/parser.lalrpop |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a BNF grammar for VRL available somewhere? I'm interested in a formal definition of exactly what the VRL allows in its grammar.
For instance, https://vector.dev/docs/reference/vrl/expressions/#whitespace says the following about whitespace:
However, as far as I can see, this doesn't appear to be the case.
For instance, the following two VRL programs differ only in whitespace, and yet are semantically different (in that the second doesn't compile):
A more tricky example might be something like the following, where both programs are valid, differ only in whitespace, and yet are slightly semantically different:
There is sort of a grammar for each expression type in https://vector.dev/docs/reference/vrl/expressions/, but it'd be nice to see something more formal.
I imagine I could also take a look at the lexer and parser code to answer my own questions about whitespace, but I was wondering if there was already some sort of formal grammar available.
(I originally asked this question on Discord at https://discord.com/channels/742820443487993987/764187584452493323/1193119283488759859 and was directed here)
Beta Was this translation helpful? Give feedback.
All reactions