Hello,

i have a question regarding the LEMON parser generator:

I am writing an expression grammar. The token LT means "<", while GT means ">".
When i use this grammar, everything works as expected:

%nonassoc  LT GT .
ex ::= ex LT ex .
ex ::= ex GT ex .

There are no conflicts, and the non-associativity is handled correctly, e.g. 
the expression "2 < 3 < 4" is reported as a syntax error.

However, changing the grammar to

%nonassoc  COMPARISON .
ex ::= ex LT ex . [COMPARISON]
ex ::= ex GT ex . [COMPARISON]

does not work as i expected. First, the expression "2 < 3 < 4" is not reported 
as a syntax error, but is processed instead. Moreover, parsing conflicts are 
reported between LT and GT. I thought that both versions should be equivalent?

Do i make a mistake or is that a bug? I have tried the above example in the 
LIME parser generator for PHP, which is described as ported from LEMON, and 
there it worked as expected (using the %prec directive). I will need this 
feature (setting precedence in a rule) for a domain specific language with a 
rather complex expression grammar.

Greetings + Thanks for Helping
Stefan

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to