Re: RPN as intermediate code?

odersky@ira.uka.de (Martin Odersky)
Tue, 29 Aug 1995 16:35:30 GMT

          From comp.compilers

Related articles
RPN as intermediate code? gorelick@esther.la.asu.edu (1995-08-22)
Re: RPN as intermediate code? lkaplan@BIX.com (1995-08-25)
Re: RPN as intermediate code? jaidi@technet.sg (1995-08-26)
Re: RPN as intermediate code? odersky@ira.uka.de (1995-08-29)
Re: RPN as intermediate code? ukln@rzstud2.rz.uni-karlsruhe.de (1995-08-31)
Re: RPN as intermediate code? hbaker@netcom.com (1995-09-02)
Re: RPN as intermediate code? mejohnsn@netcom.com (1995-09-11)
Re: RPN as intermediate code? bevan@cs.man.ac.uk (1995-09-06)
Re: RPN as intermediate code? Robert.Corbett@Eng.Sun.COM (1995-09-12)
| List of all articles for this month |

Newsgroups: comp.compilers
From: odersky@ira.uka.de (Martin Odersky)
Keywords: interpreter
Organization: Compilers Central
References: 95-08-164
Date: Tue, 29 Aug 1995 16:35:30 GMT

Noel Gorelick writes (on RPN translations):


      However, when I get into conditionals and loops, I have absolutely no idea
      how to proceed. Do I really have to get all the way down to the level of
      computing jump offsets and implement these as conditional gotos? Or is
      there a more elegant way that I just haven't found yet?


I believe there is one. All you need is a construct that pushes the
address of a given chunk of code on the execution stack. That address
can then be used by instructions for conditionals, loops etc. E.g.
you would translate


while x <= y do x := x * x


to:


pushc x y <=
pushc x x * x:=
while


Cheers


-- Martin Odersky
--


Post a followup to this message

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