Dear Monks,
maybe I'm just plain stupid here, but I can't help thinking about it.
Most of use probably use a more or less advanced editor while programming perl (and other languages) and we love the syntax-highlighting (aka font-lock) and indention mechanisms. And then from time to time there is an error in the editors machine, like a wrong highlighting after a complex regexp (e.g. put a unescaped '#' into a perl regexp and view with xemacs) or some problems with indention after a POD (xemacs, too; I just don't know any other editors well enough to get to their errors).

Wouldn't it be nice if the language itself would provide an interface to it's parse tree (am I using the word correctly here?), the structure and information of the programm. The language itself probably knows all the secrets/semantics and syntax it has and if it would be able to export this another application could be importing it.

I could think of an XMLish way of representing a language; s.th. like:

<programm language="perl" filename="hello_world.pl"> <scope name="global"> <function-definition name="hello" args="none"> <text> print "Hello world\n"; </text> </function-definition> <text> hello(); </text> </scope> </programm>
(probably the tag text would better be named code but you know about PM's code-Tags ;-)

And then there would be some kind of stylesheet which could provide a description of how to show that programm-code.

Well, as I said, maybe I'm just plain stupid here and don't think very far, but still this strikes me as a good idea: let the language export their information so that the editor developers don't have to keep in pace... What do you think?

Regards... Stefan
you begin bashing the string with a +42 regexp of confusion


In reply to Parse Tree Export (as XML?) by stefan k

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.