On Thu, Mar 06, 2008 at 06:46:04AM -0700, Jim Cromie wrote:
> perl5 has a facility to dump the optree in XML,
> which is currently not regression tested.
> Ive submitted a test-file which tests the XML output
> against a few golden-samples, but its been ignored/overlooked.
> So let me ask:
> is MAD XML output used in any way currently (or in future) ?

The MAD output is intended primarily for a Perl5-to-Perl6 translator.
(A preliminary version of which was written by Sage LaTorra for the
2006 SoC, but hasn't been worked on since then to my knowledge.)
It's possible that MAD could also replace uses in which people want
to use PPI but PPI doesn't really understand the code well enough
to produce a correct structure.  It can also give you a deparse that
actually reproduces everything in the original text.

> is there a DTD or SCHEMA to validate with ?

No, it is not intended to be used that way.  It really only needs
to be well-formed enough for the downstream tools to work with,
and there's really only one tool that does, which is called "nomad".
The purpose of nomad is to take the relatively insane output of
MAD and reattach nodes nearer to where they ought to have been in
the first place if the Perl 5 tokener/parser didn't lie to itself

> can anyone suggest a short list of (non-)? validating XML parsers
> that, if found on a box, could be used to test that the MAD output
> is well formed xml, legal - conforming to the DTD.

The nomad program simply uses the XML::Parser module.

> Im on linux, so I'll probably use xmllint, what about windoze ?

XML::Parser works anywhere, if you have it on the box.

Anyway, MAD is just using xml as a simple structured text
representation, not the be-all and end-all of interoperability.
Nowadays I'd probably just have it spit out yaml instead of xml.
In fact, nomad has an option to translate to yaml, which is what the
existing translator uses for input.  (Which can be found in the pugs
repo at ./misc/pX/Common/P5_to_P6_Translation/ASTTranslate.hs and

At some point we'll probably rewrite most of these tools in Perl 6,
except for the parts that are too MAD to reimplement without rewriting
Perl 5 itself in place, which would break it by fixing it...


Reply via email to