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

Re: Error with very small grammar



Pascal AUDANT wrote:

Greetings again,

Sorry to bother again but I have tried the small Grammar exemple that Mr Gagnon have shown me which goes like this :

Package test;

Tokens

a = 'a';

b = 'b';

Productions

s = a s a |

b;

There are two problems with the above grammar:
1) the two a's need to be uniquely identified: try
s = [first]:a s [second]:a
2) the two alternatives need to be uniquely identified: try
s = {alternative_one} [first]:a s [second]:a |
{alternative_two} b ;

You can reduce this to
s= a s [second]:a |
{alternative_two} b ;

When I run it with sablecc I obtain the following error :

Java.lang.RuntimeException : [7,12] Redefination of AS.A.

Can anybody tell me what I am doing wrong ?

Also is there someway to install sablecc under Windows XP (I tried with Ant but couldn’t build …)

Thanx a lot for your help !!



--
-------------------------------------------------------------
ninth ave (dot net)                        p: +61 7 3870 8494
     _       _       _                    m: +61 405 048 371
  __(@)<  __(@)>  __(@),          w: http://www.ninthave.net
  \___)   \___)   \___)              e: r.keays@ninthave.net
-------------------------------------------------------------