Closed ptal closed 8 years ago
I remember some other author of a parser generator saying he wants to keep the specification language independent from the host language. What's the harm in making them dependent?
You can make more than one version of a parser (for example OMeta/JS, OMeta/Ruby, PyMeta, etc.). Or, when a parser is ported to any other language, that language can just embed Rust.
I feel that grammars with code inside are less clear. Also, it doesn't help people to read a grammar if they don't understand the host-language. Another, more practical reason, is that you would need to force the user to annotate the closure with its return type which make things looking even worst. I'm not even sure you wouldn't need to annotate the parameters too.
Summary: Too much pain for little benefits.
I will close this because I feel we would lose in clarity if we allow this kind of semantic action. Also, I would like to keep the grammar independent from the host language.