|operator precedence parsing and short-circuiting boolean expr firstname.lastname@example.org (Saroj Mahapatra) (1999-11-28)|
|From:||Saroj Mahapatra <email@example.com>|
|Date:||28 Nov 1999 09:49:12 -0500|
|Organization:||AT&T WorldNet Services|
|Keywords:||parse, question, code, comment|
I use operator precedence parsing to parse a formula and generate
intermediate code which gets executed several times later. This
works. Now I need to change the code generation in such a way that in
a boolean expression A and B, B is evaluated only if A is
true. (Similar rule for 'or'.) That means, I have to generate 'goto'
statements in the intermediate language at appropriate time. My
question is at what time do I generate a 'goto' and to where? (I
generate a 'code' array for intermediate language.) Considering that
one can have multiple levels of paranthesis and functions with
multiple arguments, I am afraid that I may introduce mistakes in the
program, if I do not code properly.
Can somebody experienced in this problem please help?
[Most compiler texts work this out. It's a little messy, but pretty
Return to the
Search the comp.compilers archives again.