Need recommendations on parsing an instruction matrix

S

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
 
S

sln

On Thu, 17 Jul 2008 20:59:39 GMT, (e-mail address removed) 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
 
S

sln

On Thu, 17 Jul 2008 20:59:39 GMT, (e-mail address removed) 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
 
T

Ted Zlatanov

On Thu, 17 Jul 2008 20:59:39 GMT (e-mail address removed) 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top