Re:Ask HN: Please Review My Metalanguage
by kstenerud on Thursday February 09, 2023 @05:57AM
(#34722211)
There's no parser generator; its primary purpose is to document how a format looks and works (similar to what ABNF and EBNF do). I am trying to make it consistent enough that tools could be made for it, however.
The & is something I added later, and I thought I'd updated all of the examples but I must have missed some. Using whitespace as an operator was just causing too much trouble and making the more complex grammars harder for a human to follow, which is why I opted to make every operation require an actual symbol, and leave whitespace without semantic value.
Re:Ask HN: Please Review My Metalanguage
by UncleEntity on Thursday February 09, 2023 @06:33AM
(#34722445)
> Using whitespace as an operator was just causing too much trouble and making the more complex grammars harder for a human to follow…
Something (it’s late and I don’t quite remember) I’ve been playing with lately defines a rule named ‘_’ as the whitespace token so the grammars are both easily read and clear. Be like:
_ = [ \t]+
a = b _ (c | d) _ e
Is the & really necessary? It seems to me like they could be removed without losing anything (but it is late at night here so I may be missing something).
Related to the previous question, if & is necessary are there typos in "byte(type) byte(bind(length, ~)) & byte(~){length};" and "'(' & TOKEN_SEP item TOKEN_SEP & ')';", which are missing some?