Ask for the syntax of representing operators in Common-Lisp



The original question suggests to me that that Nguyen Huong doesn't know
Lisp, or doesn't quite know what "parse" means.  The expression internal to
Maxima is already parsed. The file output could be read in by the lisp
"read" function to reconstitute the parsed tree version.  The internal
version could also be translated into conventional Lisp, and then compiled
into assembly language. The commands translate and compile do that.

That is, to compile a Maxima expression, probably calling compile()
plausibly does what Mr. Huong is asking.  But maybe he is not really telling
us what he wants.

For example...

To UNparse an expression, e.g. write it out in infix form, the usual way
would be to use grind() or string().

It is also possible to output stuff using the syntax of fortran or C in case
your intention is to take Maxima calculations and stuff the results into a
Larger piece of code already written in those languages.  

The fortran() command is included.  The "gentran" stuff is not in the
distribution, but Paul Wang supervised its development.

RJF


-----Original Message-----
From: maxima-admin at math.utexas.edu [mailto:maxima-admin at math.utexas.edu] On
Behalf Of Robert Dodier
Sent: Monday, July 10, 2006 2:12 PM
To: Nguyen Huong
Cc: maxima at math.utexas.edu
Subject: Re: [Maxima] Ask for the syntax of representing operators in
Common-Lisp

Hello,

>  In order to write the compiler, I need to know exactly about the abstract
> syntax to parse the above file, or at least the syntax to parse the part
> representing the expression "((MPLUS SIMP)
>             ((MTIMES SIMP) ((RAT SIMP) 1 2) ((MEXPT SIMP) $X 2))
>             ((MTIMES SIMP) ((RAT SIMP) 1 3) ((MEXPT SIMP) $X 3))))

Not sure what you want to do, but working with the S-expression
is probably the right thing to do if you need to manipulate the
expression -- it is essentially a parse tree. Maybe you can find
a S-expression parser already written in the language of your choice.

About internal representation of Maxima expressions, see:

http://maxima.sourceforge.net/wiki/index.php/outline%20of%20Maxima%20interna
ls
http://maxima.sourceforge.net/wiki/index.php/Maxima%20internals

HTH
Robert Dodier

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima