operator precedence parsing and short-circuiting boolean expr

Saroj Mahapatra <saroj-tamasa@worldnet.att.net>
28 Nov 1999 09:49:12 -0500

          From comp.compilers

Related articles
operator precedence parsing and short-circuiting boolean expr saroj-tamasa@worldnet.att.net (Saroj Mahapatra) (1999-11-28)
| List of all articles for this month |
From: Saroj Mahapatra <saroj-tamasa@worldnet.att.net>
Newsgroups: comp.compilers
Date: 28 Nov 1999 09:49:12 -0500
Organization: AT&T WorldNet Services
Keywords: parse, question, code, comment

Hi,


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?


Thanks,
Saroj
[Most compiler texts work this out. It's a little messy, but pretty
straightforward. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.