Re: Implementing a stack-based interpreter

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
5 Aug 2005 18:10:43 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: Implementing a stack-based interpreter gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-07-22)
Re: Implementing a stack-based interpreter john.carter@tait.co.nz (John Carter) (2005-07-22)
Re: Implementing a stack-based interpreter Jan.Bogaerts@telenet.be (Jan Bogaerts) (2005-07-22)
Re: Implementing a stack-based interpreter anton@mips.complang.tuwien.ac.at (2005-07-26)
Re: Implementing a stack-based interpreter dot@dotat.at (Tony Finch) (2005-07-26)
Re: Implementing a stack-based interpreter marcov@stack.nl (Marco van de Voort) (2005-08-03)
Re: Implementing a stack-based interpreter mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2005-08-05)
Re: Implementing a stack-based interpreter rossen.radev@gmail.com (aquarin) (2005-08-05)
Re: Implementing a stack-based interpreter tk@ic.unicamp.br (Tomasz Kowaltowski) (2005-08-07)
Re: Implementing a stack-based interpreter kszabo@bcml120x.ca.nortel.com (2005-08-07)
Re: Implementing a stack-based interpreter haberg@math.su.se (2005-08-10)
| List of all articles for this month |

From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.compilers
Date: 5 Aug 2005 18:10:43 -0400
Organization: cbb software GmbH
References: 05-07-070 05-07-080 05-08-010
Keywords: interpreter

On 3 Aug 2005 01:32:12 -0400, Marco van de Voort wrote:


> I also have a Pascal (Delphi) example of this here:
>
> http://www.stack.nl/~marcov/symbolic.zip


Yep, it is the same method.


You refer to 5+x+7 -> x+13 simplification problem. I'm using for it the
following method. Operations like + are marked as ones of a commutative
group. When tree (or its equivalent) is generated "+"("+"(5,x),7) is
automatically collapsed by the parser into "+"(5,x,7). Having one node one
can shuffle constants together. I also works with "-" (see my page for
details.) However, it has a limited use anyway, because in presence of many
types +, -, *, / etc can be overloaded with non-commutative user-defined
implementations. So type resolution must be done first.


BTW, does anybody know the author of the infix to reverse Polish notation
conversion algorithm? I failed to find any references, so far.


--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


Post a followup to this message

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