Need recommendations on parsing an instruction matrix

Discussion in 'Perl Misc' started by sln@netherlands.com, Jul 17, 2008.

  1. Guest

    Below is a range (Find/Action) of parameters that can be passed to a parsing function.
    I am going to parse this as a matrix. This is a serialized instruction matrix that can
    have duplicates. Not only do I wan't to parse and validate it, but I wan't to put it into
    a form where the sequence can be easily accesable and tracked during processing.

    There will be duplicates, so it is passed and read as an array. On the user side, LINK
    has no parameter. Otherwise its a square matrix.

    Any help would be appretiated.
    (the below table will not show correct columns)


    Event Instruction Sequence Matrix (EISM)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Find | Action
    -------------~~~~ | -----------------
    |
    <any N/A action> | REPLACE => 'data'
    <any N/A action> | REMOVE => ''
    <any N/A action> | INSERT => 'data'
    <any N/A action> | CALL => \&sub
    <only Rx_ find> | Rx_REPLACE => 'data'
    LINK => 1 | N/A
    LINK => 0 | N/A
    CMNT => 'data' | <any valid action>
    CDATA => 'data' | <any valid action>
    CONT => 'data' | <any valid action>
    TAG => 'data' | <any valid action>
    ATTR => 'data' | <any valid action>
    VALU => 'data' | <any valid action>
    XMLDCL => 'data' | <any valid action>
    XMLVER => 'data' | <any valid action>
    XMLENC => 'data' | <any valid action>
    XMLSTAND => 'data' | <any valid action>
    PI => 'data' | <any valid action>
    DOCTYP => 'data' | <any valid action>
    ENTITY => 'data' | <any valid action>
    ENTGENR => 'data' | <any valid action>
    ENTPENR => 'data' | <any valid action>
    ATTLIST => 'data' | <any valid action>
    ELEMENT => 'data' | <any valid action>
    ----
    Rx_CMNT => 'data' | <any valid action>
    Rx_CDATA => 'data' | <any valid action>
    Rx_CONT => 'data' | <any valid action>
    Rx_TAG => 'data' | <any valid action>
    Rx_ATTR => 'data' | <any valid action>
    Rx_VALU => 'data' | <any valid action>
    Rx_XMLDCL => 'data' | <any valid action>
    Rx_XMLVER => 'data' | <any valid action>
    Rx_XMLENC => 'data' | <any valid action>
    Rx_XMLSTAND => 'data' | <any valid action>
    Rx_PI => 'data' | <any valid action>
    Rx_DOCTYP => 'data' | <any valid action>
    Rx_ENTITY => 'data' | <any valid action>
    Rx_ENTGENR => 'data' | <any valid action>
    Rx_ENTPENR => 'data' | <any valid action>
    Rx_ATTLIST => 'data' | <any valid action>
    Rx_ELEMENT => 'data' | <any valid action>

    thanks
    sln
    , Jul 17, 2008
    #1
    1. Advertising

  2. Guest

    On Thu, 17 Jul 2008 20:59:39 GMT, wrote:

    One thing. The instruction sequence is atomic, no Action is done unless the
    complete sequence of Find instructions is valididated during processing.

    I forgot the most important Action, no action:

    Find | Action
    -------------~~~~ | -----------------
    |
    <any N/A action> | NOACTION => ''


    sln

    >Below is a range (Find/Action) of parameters that can be passed to a parsing function.
    >I am going to parse this as a matrix. This is a serialized instruction matrix that can
    >have duplicates. Not only do I wan't to parse and validate it, but I wan't to put it into
    >a form where the sequence can be easily accesable and tracked during processing.
    >
    >There will be duplicates, so it is passed and read as an array. On the user side, LINK
    >has no parameter. Otherwise its a square matrix.
    >
    >Any help would be appretiated.
    >(the below table will not show correct columns)
    >
    >
    >Event Instruction Sequence Matrix (EISM)
    >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    >
    >Find | Action
    >-------------~~~~ | -----------------
    > |
    ><any N/A action> | REPLACE => 'data'
    ><any N/A action> | REMOVE => ''
    ><any N/A action> | INSERT => 'data'
    ><any N/A action> | CALL => \&sub
    ><only Rx_ find> | Rx_REPLACE => 'data'
    >LINK => 1 | N/A
    >LINK => 0 | N/A
    >CMNT => 'data' | <any valid action>
    >CDATA => 'data' | <any valid action>
    >CONT => 'data' | <any valid action>
    >TAG => 'data' | <any valid action>
    >ATTR => 'data' | <any valid action>
    >VALU => 'data' | <any valid action>
    >XMLDCL => 'data' | <any valid action>
    >XMLVER => 'data' | <any valid action>
    >XMLENC => 'data' | <any valid action>
    >XMLSTAND => 'data' | <any valid action>
    >PI => 'data' | <any valid action>
    >DOCTYP => 'data' | <any valid action>
    >ENTITY => 'data' | <any valid action>
    >ENTGENR => 'data' | <any valid action>
    >ENTPENR => 'data' | <any valid action>
    >ATTLIST => 'data' | <any valid action>
    >ELEMENT => 'data' | <any valid action>
    >----
    >Rx_CMNT => 'data' | <any valid action>
    >Rx_CDATA => 'data' | <any valid action>
    >Rx_CONT => 'data' | <any valid action>
    >Rx_TAG => 'data' | <any valid action>
    >Rx_ATTR => 'data' | <any valid action>
    >Rx_VALU => 'data' | <any valid action>
    >Rx_XMLDCL => 'data' | <any valid action>
    >Rx_XMLVER => 'data' | <any valid action>
    >Rx_XMLENC => 'data' | <any valid action>
    >Rx_XMLSTAND => 'data' | <any valid action>
    >Rx_PI => 'data' | <any valid action>
    >Rx_DOCTYP => 'data' | <any valid action>
    >Rx_ENTITY => 'data' | <any valid action>
    >Rx_ENTGENR => 'data' | <any valid action>
    >Rx_ENTPENR => 'data' | <any valid action>
    >Rx_ATTLIST => 'data' | <any valid action>
    >Rx_ELEMENT => 'data' | <any valid action>
    >
    >thanks
    >sln
    , Jul 17, 2008
    #2
    1. Advertising

  3. Guest

    On Thu, 17 Jul 2008 20:59:39 GMT, wrote:

    Also, let me say that the implementation is pretty ambitous here given the permutations
    the posible input represents. If you have comments about that handling, it is welcome
    as well. In fact any constructive help is always welcome, no matter how trivial.

    thank you
    sln

    >Below is a range (Find/Action) of parameters that can be passed to a parsing function.
    >I am going to parse this as a matrix. This is a serialized instruction matrix that can
    >have duplicates. Not only do I wan't to parse and validate it, but I wan't to put it into
    >a form where the sequence can be easily accesable and tracked during processing.
    >
    >There will be duplicates, so it is passed and read as an array. On the user side, LINK
    >has no parameter. Otherwise its a square matrix.
    >
    , Jul 17, 2008
    #3
  4. Ted Zlatanov Guest

    On Thu, 17 Jul 2008 20:59:39 GMT wrote:

    s> Below is a range (Find/Action) of parameters that can be passed to a parsing function.
    s> I am going to parse this as a matrix. This is a serialized instruction matrix that can
    s> have duplicates. Not only do I wan't to parse and validate it, but I wan't to put it into
    s> a form where the sequence can be easily accesable and tracked during processing.

    s> There will be duplicates, so it is passed and read as an array. On the user side, LINK
    s> has no parameter. Otherwise its a square matrix.

    Try Parse::RecDescent to build your grammar. No need for an instruction
    matrix, and when it parses your input you can get a nice parse tree if
    you use the <autotree> directive.

    Ted
    Ted Zlatanov, Jul 18, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lvcargnini

    Matrix composed by two matrix

    lvcargnini, Jul 4, 2006, in forum: VHDL
    Replies:
    3
    Views:
    2,640
    Jonathan Bromley
    Jul 5, 2006
  2. Holgerson

    Matrix*Vector and Vector*Matrix

    Holgerson, Oct 25, 2007, in forum: C++
    Replies:
    3
    Views:
    391
    Holgerson
    Oct 26, 2007
  3. Terry Reedy
    Replies:
    0
    Views:
    538
    Terry Reedy
    Apr 2, 2009
  4. Steven W. Orr

    Need instruction on how to use isinstance

    Steven W. Orr, Jun 28, 2010, in forum: Python
    Replies:
    0
    Views:
    259
    Steven W. Orr
    Jun 28, 2010
  5. Stephen Hansen
    Replies:
    9
    Views:
    453
    alex23
    Jul 1, 2010
Loading...

Share This Page