Function declaration

Casper Færgemand" <shorttail at hotmail.com> Casper Færgemand" <shorttail at hotmail.com>
Wed Dec 25 16:16:15 PST 2013


On Wednesday, 25 December 2013 at 21:23:23 UTC, Philippe Sigaud 
wrote:
> I'll consider that as a D grammar question, and not a 
> Pegged-specific
> question, since Pegged just uses a copy of the D site grammar 
> :-)
Thank you regardless. I'll be sure to submit some issues once 
we're a bit further down the road. Error handling is what has 
displeased me the most so far, with only a single test case ever 
displaying something useful. I'm not sure what the solution 
should be though, perhaps the matches that munched the most 
tokens before failing?
Also, it should be possible to detect non-munching cycles aka. 
left recursion without too much extra compile time. It's funny 
because it's fine on compile time, but instant death at runtime. 
I'll post some of that once we're further.


On Wednesday, 25 December 2013 at 22:28:06 UTC, Timon Gehr wrote:
> The following is a parse tree for char* format:
> snip
Oooh, I missed that. I didn't think it possible one would dissect 
it like that. In my mind it would make more sense to keep char 
and * together, since it's a type of its own. Interesting. And 
weird.


> I consider the grammar specification (as well as some details 
> of what is valid syntax) to be quite inelegant, unnecessarily 
> repetitive and inconvenient for parser generators, but I am not 
> sure if a clean-up would be welcome.
I'm not sure. I haven't imported too much yet, but the only thing 
I've had to work around was left recursion in some arithmetic 
expressions (add and mul I believe). It's complicated for sure, 
but the language specification has survived nearly intact. My 
only past experience is the toy language Tiger made for education 
and stories I've been told of "normal" language specifications 
being really awful. So some copy paste is nice for a change.

I'd still like a look at a "clean" grammar if anyone has one 
around.


More information about the Digitalmars-d-learn mailing list