[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

q regarding sablecc3 AST notation (?, +, *)



I'm working here with the sablecc3 and so far so good. I do have one
question tho.

Why did you get away with the '+' and '?' notation at the AST section.
I think that was not a nice idea. My reasoning:

As you say the end result of the produced grammar is in the AST section.
So a programmer who works with only the AST and does not really
understand the grammar (he does not need to understand anymore)
might get a wrong idea on how many elements are here and there.

I found myself making that mistake just a few times already.

Exmaple - 'expr ?': should it be just 'expr' or 'expr *'? Both cases seem to
work, but for a programmer who looks at the AST section has no idea
that the element there should be either zero or one. Of course I can
add a comment after the production rule specifying it but that does
not seem right.

In other words I think we loose valuable information that is neccessary
for developers and software maintenance. This just creates confusion.

Regards,
Indrek