[sldev] Any lex & yacc gurus? Looking at VWR-68
Soft Linden
soft at lindenlab.com
Thu Jun 14 17:27:15 PDT 2007
A lot of ya know we're busily catching up on old patches. Sorry this
took as long as it did. :(
One that's got me a bit stumped at the moment is VWR-68:
https://jira.secondlife.com/browse/VWR-68
The patched grammar properly takes care of the following:
integer i;
integer x = 5;
for( i = 0; i < x-1; i++ ) // SYNTAX ERROR
llOwnerSay( (string)i );
The above gives a syntax error in current LSL scripts because the
grammar greedily parses -1 as a constant, netting the token sequence
"variable constant" instead of "variable operator constant." The new
grammar fixes that.
Unfortunately, the patched grammar is now too greedy when it tries to
fold constant expressions:
x = x - 5 - 5; // becomes x = x - (5-5) becomes x = x - 0
I haven't played with lex and yacc in ages. My initial inclination was
to try the alternate fix of knocking '-' off the choice of D tokens in
the unpatched lex and changing the yacc file to make '-' a unary
operator instead of an optional constant integer prefix as it is in
Argent's patch. But this would break initialization of negative global
constants unless I hack the assignment operator to explicitly parse
negative assignments. That's a gross hack. :/
Any chance a refinement to VWR-68 is a shallow problem for anyone on the list?
More information about the SLDev
mailing list