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

Re: Redefinition Error



Hi Nikolaos,

> I keep getting a redefinition error and I would really appreciate some
> help.
>
> message =
> 	{depend}dependence P.tpu id arrow id  |
> 	{insert} inserting P.tpu id  |
> 	{successfork} forking P.tpu forkinfo? ok activethreads	|
> 	{unsuccessfork} forking P.tpu forkinfo   not ok activethreads 	|
> 	{delay} delay P.tpu id colon [period]:int |
> 	{update} updating P.tpu id |
> 	{leave} leaving P.tpu id id;
>
> Error:Redefinition of ADependMessage.Id.

If you have the same token/production on the right hand side of the
production rule, you need to explicitelly prefix the name, in other words
in your first and last  production you need to do something like this:

 message =
       {depend} dependence P.tpu [first]:id arrow [second]:id  |
       ...
       {leave} leaving P.tpu [first]:id [second]:id ;

It has to do with the typing system of SableCC. In the generated code,
ADependMessage node will have two methods, getFirstId() and getSecondId(),
which will distinguish for you these two seperate tokens/productions.

Hth
Mariusz