Re: mathematical expressions (VBDis)
13 May 2003 04:21:38 -0400

          From comp.compilers

Related articles
mathematical expressions (Seidl Markus) (2003-05-06)
Re: mathematical expressions (Rajesh N Thipse) (2003-05-12)
Re: mathematical expressions (Robert A Duff) (2003-05-13)
Re: mathematical expressions (2003-05-13)
Re: mathematical expressions (2003-05-15)
Re: mathematical expressions (Guillermo Phillips) (2003-05-15)
| List of all articles for this month |

From: (VBDis)
Newsgroups: comp.compilers
Date: 13 May 2003 04:21:38 -0400
Organization: AOL Bertelsmann Online GmbH & Co. KG
References: 03-05-033
Keywords: arithmetic
Posted-Date: 13 May 2003 04:21:38 EDT

"Seidl Markus" <> schreibt:

>How can i draw the squareroot, when i have the following expression:
>sqrt(sqrt(sqrt(5))) ? I think im stuck there.I think i cannot draw
>the first square because i dont know how big and long i have to made
>it, and i cannot draw the last term, because i don't know where i have
>to draw them ( distance between the left edge of the image) ....

Separate the determination of the size of an item from the
determination of its position.

During parsing every reduction should result in an image of a fixed
size, which then can be incorporated into the image for the next
reduction step. In a top-down parser the partial images would be
returned to the calling procedure, until the final image can be
positioned on the output device. Every procedure can arrange, modify
or replace the partial images as required, e.g. when the "5" and the
"2" in "5^2" has to be transformed into "5".

You also may encounter images which exceed the width of the output
device. Then some "wrapping" is required, like when a long text must
be broken into multiple lines. Breaking formulas into multiple lines
can become complicated, e.g. for a fraction with a long dividend or,
even worse, with a long divisor.

I'd separate the task into an parser, which creates an appropriate
parse tree from the input, and an post processor, which does the
layout of that tree.


Post a followup to this message

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