Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow closure as semantic action #41
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.