| parrotcode: Simple XML Parser | |
| Contents | Examples | 

examples/pasm/xml_parser.pasm - Simple XML Parser

    % ./parrot examples/pasm/xml_parser.pasm examples/pasm/small.xml

This is a rudimentary XML-ish parser in PASM. It currently handles only well-formed XML, doesn't throw errors, etc...
Limitations:
< aren't handled yetThis is more of a proof-of-concept than anything else. Try putting this in a file:
    <xml version='1.0'>
    <top>
    <inner foo='bar' narf='poit'>
    <junk>Hello</junk>
    <empty/>
    </inner>
    </top>
And see what it does. :)
See the notes near the read() for IO problem notes.
Register Usage:
    S0, S1, S2, S5 -- Temporary Registers
    S7             -- Current token in procintags()
    S10            -- HACK for broken I/O
    S11            -- Character being processed
    I0, I1, I2     -- Temporary Registers
    I7             -- Type of current element
    I8             -- "In Quotes" flag
    I13            -- Type of the last token
The stack is used all to hell. :)
Data is stored on the stack in type/value pairs:
      -1 ""  (uninitialized slot)
       0 Element Name
       1 Attribute Name
       2 Attribute Value
       5 Close of Element (no data)
       6 Close of Element, also start (no data)
      99 Data associated with this element
    1000 (no data) sentinel for the bottom of the stack

examples/pasm/small.xml.

    (First Parrot Assembler Program)
    Clinton A. Pierce  3/13/2002
    clintp@geeksalad.org
    Freely Redistributable
        
|  |   |