Well this may soon become of a formidable complexity. For one thing you should do the parsing of the expressions in the first place. I'm not even trying to do anything like that because admittedly I have no experience at all in this field. However as a general direction you may either roll-your-own solution or design a very simplified grammar with e.g. Parse::RecDescent.

IIRC something roughely along these lines had been discussed on clpmisc short before I stopped regularly following it.

As far as the (Tk) UI is concerned, it's simply up to you and to your skills and tastes, however this seems to me like a task well suited for a cmd-line console based UI, so if you really want to go graphical, then probably something as simple as a window with an input field, a text field for output and an update button would suffice.

UPDATE: Now that I re-read this, I realize that you were most probably referring to the formatting of mathematical expressions. Then in practice you're asking about implementing a typesetting engine, even if you may be content with an elementary one. In any case it won't be an easy task. I recommend you give a peek into the (La)TeX world instead. In particular you may be interested in mimeTeX and preview-latex.


In reply to Re: Perl and maths by blazar
in thread Perl and maths by ReinhardE

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.