writing a symbolic interpreter

rouben@pc18.math.umbc.edu (Rouben Rostamian)
20 Dec 2003 11:52:54 -0500

          From comp.compilers

Related articles
writing a symbolic interpreter rouben@pc18.math.umbc.edu (2003-12-20)
Re: writing a symbolic interpreter cioina@hotmail.com (Cioina Alexei) (2003-12-21)
| List of all articles for this month |

From: rouben@pc18.math.umbc.edu (Rouben Rostamian)
Newsgroups: comp.compilers
Date: 20 Dec 2003 11:52:54 -0500
Organization: A poorly-installed InterNetNews site
Keywords: interpreter, question
Posted-Date: 20 Dec 2003 11:52:54 EST

I am interested in writing a symbolic parser/interpreter for
mathematical expressions. For instance, the program should
be able to handle simple symbolic statements and loops of
the sort:

--- sample input file ----------
r := sqrt(x^2 + y^2);
x := r*cos(t);
y := r*sin(t);

for (i=0; i<5; i++) {
        x := r*cos(i*t);
        y := r*sin(i*t);
        print x, y;

and produce the output:

r*cos(0*t), r*sin(0*t)
r*cos(1*t), r*sin(1*t)
r*cos(2*t), r*sin(2*t)
r*cos(3*t), r*sin(3*t)
r*cos(4*t), r*sin(4*t)

I am pretty comfortable with programming in C and using lex and yacc.
I know how to write a numerical interpreter, as in a multi-function

I have some ideas about how to go about writing a symbolic interpreter
but I can use some help to put me on the right track.

I would appreciate any advice and suggestions that you may have,
such as books, web site, free software, etc.

Rouben Rostamian

Post a followup to this message

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