Related articles |
---|
Maximum number of temporary variables needed for math expressions ehsan.akhgari@gmail.com (2005-11-08) |
Re: Maximum number of temporary variables needed for math expressions RLake@oxfam.org.uk (2005-11-12) |
Re: Maximum number of temporary variables needed for math expressions henry@spsystems.net (2005-11-12) |
Re: Maximum number of temporary variables needed for math expressions spammer@b2z.com (Omri Barel) (2005-11-12) |
Re: Maximum number of temporary variables needed for math expressions n1356597638.ch@chch.demon.co.uk (Charles Bryant) (2005-11-12) |
From: | ehsan.akhgari@gmail.com |
Newsgroups: | comp.compilers |
Date: | 8 Nov 2005 23:37:15 -0500 |
Organization: | Compilers Central |
Keywords: | arithmetic, comment |
Posted-Date: | 08 Nov 2005 23:37:15 EST |
Hi all,
Is there any upper bounds on the number of temporary variables that are
needed to translate any given mathematical expression? By intuition, I
guess the answer is 2, but I'm looking for a (possibly formal) proof to
make sure. To make clear what I mean, here is a simple three address
code translation of a math expression using 2 temporary variables:
x+((a+b)*(c/d)-(e*f))
# opcode, operand1, operand2, result
+, a, b, t1
/, c, d, t2
*, t1, t2, t1
*, e, f, t2
-, t1, t2, t1
+, x, t1, t1
# the result is in t1, and t2 is free
Thanks in advance,
Ehsan
[It is my vague recollection that you can use up arbitrarily large
numbers of temporaries by composing operators that aren't commutative
-John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.