in reply to Perl as XML

It would allow us (uhm programmers, hackers, whatever you want to call yourself) to write logics and have some preprocessort write the actual code. ... Personally, I'd rather use some kinda preprocessable pseudo code, than code in Cobol all day long.

If we regard programming as some kind of "writing" activity, like writing English prose, then I pose the question: Would you rather like to write this XML stuff you propose above or something like COBOL? Even Cobol might be less wordy than the alternative that you propose. I could see your example as *output* of some preprocessor, but for input, I would prefer something more convenient (for a good example, have a look at the input language for GraphViz or read chapter 17 (Template Driven Code Generation) in Advanced Perl Programming).

XML (with the right DTD) would suit the purpose, and it would improve porting issues for ancient applications.

Either you are an SGML/XML genius, or I am missing something here. I don't think it will be easy to parse a programming language (even something rather simple, like COBOL) with an SGML/XML parser.

In fact, it is impossible for most contemporary programming languages, if I interpret Formalizing SGML and XML Instances and Schemata with Forest Automata Theory correctly (in short: "The fundamental problem is that context free grammars describe languages much more rich, powerful and complex than SGML can represent.").

Note: If anybody out there has a clear theoretical understanding of these issues, I would welcome a more substantial discussion very much!

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com

Replies are listed 'Best First'.
Re: Re: Perl as XML
by Beatnik (Parson) on Jan 24, 2001 at 01:13 UTC
    On the Cobol issue: Yes, I would rather do XML than Cobol :) I am hardly a XML guru, but I already like it more than Cobol. Technically, Code is data. Uniform data, since it is built up out of keywords and variables. A lex parser backend would ofcourse be handy, since you have to DO something with the code.
    Two of many nice things about XML :

    <DIR>
  • XML was designed to describe data.
  • </DIR> <DIR>
  • XML tags are not predefined in XML. You must define your own tags.
  • </DIR>

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.