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

Re: A simple question...




Joseane,

The square brackets are used to resolve naming conflicts. For example

  add = expression plus expression ;

How can you access the different expressions? Usually, sablecc makes a
getExpression() method in the AAdd node, but if the names are the same, it
cannot. This problem can be fixed by:

  add = [left]:expression plus [right]:expression ;

Now, we can use getLeft() and getRight() to access the two expressions.

Hope that helps,

Roger

 On Fri, 31 Aug 2001,
Joseane Farias
Fidalgo wrote:

>
> Hi,
>
> I'm newer on using Sablecc and I have a simple question in the rules
> expressed in the productions of the specification-file of sablecc...
>
> When I have, for example:
> 	statement = {if} if condition [nl1]:new_line ...
>
> 	What's the meaning of the [nl1]:new_line, i.e, the construction
> [__]:____???
>
> I have studied Etienne's thesis but I think I missed some details...
>
> Thanks in advance, Joseane.
>
>