Perl Mongers Meeting Next Wednesday - dans waffling

Ewen McNeill ewen at
Thu Apr 27 04:03:52 CDT 2000

In message <NDBBJNMEKLNPINKJANGJAEDGCAAA.dan.morrison at>, "Dan Morrison"
>> Grant McLean writes:
>> >Ewen had offered to talk on state machines/code generation, or
>> >parsing SGML/XML.  (Is that offer still open Ewen?)
>Parsing XML is dull, (with the odd bit of stress thrown in by character
>Validating it is more challenging.
>Actually _USING_ XML would be interesting.

Parsing SGML is hard enough that I've never actually done it myself;
what I've done is used nsgmls (written by James Clark) and sgmlspm (a
perl module that reads ESIS and does call backs, in effect) to handle
SGML data.  Since XML is SGML with lots of restrictions and IIRC both
nsgmls and sgmlspm will handle those restrictions I think it'd probably
work for XML too.

I've used this combination and some perl scripting to do things like
my CV (with the ability to highlight skills, turn into multiple formats
(well print and HTML at present), etc), and timesheeting/invoicing.

The work I've done with XML to date has largely been with the iMatix
GSL tool (see if you want to know more -- it's
free/open source), but that's a C-based tool so is somewhat off topic.
(I should disclaim that I pretty much am iMatix New Zealand -- the NZ
offshoot of iMatix -- so I don't wish to push it here.)

I'm happy to talk about this SGML stuff if anyone cares; I've found it
useful, but maybe the more XML-specific tools are taking over the world
and no one cares any more.  (Although call-back based programming is a
useful thing to know about anyway.)

>I'm unsure what 'state machines/code generation' would entail, therefore it
>my be even more instructive to me. I have visions in my head of 'life' and
>'core wars'. Am I on the right track? 

Not really, no.  State machines are a Comp Sci formalism, and one that's
very handy when dealing with something where there are only a few
legitimate choices in any given "state" (eg, if you're waiting for some
data to arrive pretty much the only things that can happen are that it
doesn't, it does but it's not allowed, or it does and you go to the next

Code generation is a way of getting the computer to program for you :-)
No seriously, it lets you write the program logic (typically) at a
higher level, and have the computer fill in the details necessary to
make that into actual executable code (be it perl or whatever).
iMatix's answer to this is Libero (again see;
again it's free/open source).

For a fair class of problems, particularly communication oriented ones,
it's a very good way to model the problem, and you can step away from a
lot of the niggly details fairly easily (such as "what happens if
something unexpected happens here") to let them be handled by code
generated for you.

Since talking about what you've used is obviously easier than talking
about what you haven't, I'd be looking to talk about one of the
nsgmls/sgmlspm combination or the libero/perl combination (libero's code
generation is from schema files so it can target pretty much any
imperative language you choose).  But I'd try to avoid pushing any
particular tool.

Since it sounds like everyone and their dog is doing *ML in perl these
days, possibly the state machine/code generation side might be of more


More information about the Wellington-pm mailing list