If you want to see the parse tree for an expression E,
use the command line
?print(E);
you can see another form by doing this..
simp:off;
?print(?nformat(a/b));
and here's another, showing boxes...
First define this function, cut out of DISPLA ...
(DEFMFUN DIMONLY (FORM)
(LET ((DISPLAYP T)
(LINEARRAY (IF DISPLAYP (MAKE-array 80.) LINEARRAY))
(MRATP (CHECKRAT FORM))
(#.WRITEFILEP #.WRITEFILEP)
(MAXHT 1) (MAXDP 0) (WIDTH 0)
(HEIGHT 0) (DEPTH 0) (LEVEL 0) (SIZE 2)
(BREAK 0) (RIGHT 0) (LINES 1) BKPT
(BKPTWD 0) (BKPTHT 1) (BKPTDP 0) (BKPTOUT 0)
(BKPTLEVEL 0) IN-P
(MOREFLUSH D-MOREFLUSH)
(MOREMSG D-MOREMSG))
(DIMENSION FORM NIL 'MPAREN 'MPAREN 0 0)))
then
?dimonly(a/b)
still with simp off, returns
D-HBAR((- 1, 0), (- 1, - 1, b), (0, 1, a))
or its equivalent in lisp that might be easier to parse.
What macsyma's display does with this last form is it
goes through it and prints a line at a time on the page.
So all the parts are available, I think. What could be
done better is to associate the actual character widths of
the characters, in points, and place them exactly where
you want. You also have to tell the program how many points wide
your display is.
This will give you line-breaking free.
Good luck.
Abdulhaq Lynch wrote:
>On Wednesday 13 October 2004 18:39, Richard Fateman wrote:
>
>
>
>>Of course this perspective is from the computer algebra system. If what
>>you are building
>>is primarily a GUI for (say) maxima, tex, matlab, GAP, web browsers,
>>search engines, ... etc
>>and maxima is just a specialized client for a small percentage of users,
>>then the GUI
>>arguably should be the boss. The usual downside of this is that some
>>things are either
>>impossible or very very hard to do. (The lisp code shows very
>>explicitly what expressions
>>are subexpressions of others. Do we really need to re-parse? )
>>
>>
>
>Yes, this is a GUI, and nothing but a GUI, a utility to improve the UI to
>Maxima and its ilk. Yes, some things may be very hard without access to
>Maxima's internal representation. As soon as you start creating new Lisp
>functions etc., Kayali will struggle, but if there is a need then effort can
>be invested.
>
>
>
>>1. the internal lisp version as a text string. e.g. ((MPLUS SIMP) $X
>>$Y)
>>
>>
>
>
>
>>>The second good news is that it is not written in Lisp, so that the
>>>interaction to the maxima kernel is somewhat more bound to a clear
>>>interface.
>>>
>>>
>>This is questionable, given that the front end has a duplicate parser
>>for the macsyma input language,
>>written in python.
>>
>>
>>
>
>I didn't realise that Maxima's internal parse tree was available in text
>form. This is useful to know.
>
>Kayali's parser is, for all intents and purposes, a grammar definition text
>file. It is easily changed or extended, no coding is involved.
>
>The benefit of using my own parser is that it can be modified to use other
>back-end tools that also understand textual algebraic expressions of the
>form 3*x^7 or similar. This makes Kayali extensible, for instance, to use
>more numerically-oriented engines such as Octave.
>
>Abdulhaq
>
>
>