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

Re: Anybody listening?



>Anyway, [left]:something and [right]:something doesn't seem to be all one
>can put in these square brackets to distinguish two of the same type used 
>in
>a single production. I'll quote here from the sample minibasic grammar:
>
>     {for}        for identifier assign [from_exp]:expression to
>[to_exp]:expression [nl1]:new_line
>                    statements
>                  next [nl2]:new_line |
>
>...
>
>I don't see from_exp, to_exp, nl1 or nl2 defined anywhere. So does this 
>mean
>that they are "made up" just to distinguish parts which appear twice, and
>simply serve to give a name to the nodes when referring to them in the Java
>worker/tree walker code? (?) It seems like they are used to give names to
>two of the same construct used in a production, if you can see what I am
>trying to say.

yes, that's it. If you have an element that appears two or more times, then 
you have to name them. It has also to do with the generation of a valid AST. 
But if you have a look at the code it generates, then you will understand 
better. I think you can find it on Chapter 5.


Hope that's clear.

Fidel.


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp