XML in XML
Here is XML’s grammar expressed as an automaton in XML syntax. It is based on Tim Bray’s Lark grammar, which Tim has recently released.
I’ve XML-ified it to give a headstart to anyone interested in making their own XML processor: you could write an XSLT script to generate code for example. The XML version is based on a finite state machine, but with a couple of extra attributes that act on stacks. There are various Lark-specific actions included in the transitions: these provide a good guide for some of the processing required for a complete XML processor. However, of course you might prefer to annotate it with your own actions…

















