Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Can awk easily ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 2193 of 2234
Post > Topic >>

Can awk easily simulate an AFSM

by problems@[EMAIL PROTECTED] Mar 16, 2008 at 11:51 AM

Hi,
 I've just looked at awk's docos for the first time and it seems
suitable for implememting an augumented-finite-state-machine.

Imagine those syntax-diagrams for pascal from the 70s - like
railway-maps, where the tracks loop around/back from
different stations/nodes.

Now stretch it out down the left side of the page, so that
the nodes are all below each other on separate lines, where the
action corresponding to the node/token is listed on the line.
The main track is going down, and any loop-back tracks are 
going up behind/to-the-left-of the main-track.

At each/most node there's an action to be performed.
Some nodes are not terminals/leaves and just lead to 
another nested syntax-diagram via push & return via pop.

I've built several p-code compilers like this.
From what I see from awks docos, it's very suitable for
doing the [token,action] task, as the source-code is
scanned into tokens and passed to awk.

As I remember, at the branch-points a one token look ahead
only was needed for the pascal-like syntax. 

Can awk handle this ?

How would it handle the branching, eg. the sub-diagram for
statement would be like:
Case TOKEN
   'IF': next state := IF-node;
   'WHILE: next state := WHILE-node;
....

Of course FSMs are also very usefull for eg. ppp implementation,
because the spec. is even given as a FSM .........

==crg.




 7 Posts in Topic:
Can awk easily simulate an AFSM
problems@[EMAIL PROTECTED  2008-03-16 11:51:49 
Re: Can awk easily simulate an AFSM
=?ISO-8859-1?Q?J=FCrgen_K  2008-03-16 20:24:41 
Re: Can awk easily simulate an AFSM
Janis Papanagnou <Jani  2008-03-18 04:00:05 
Re (2): Can awk easily simulate an AFSM
problems@[EMAIL PROTECTED  2008-03-18 05:46:17 
Re: Re (2): Can awk easily simulate an AFSM
=?ISO-8859-1?Q?J=FCrgen_K  2008-03-18 19:35:53 
Re (3): Can awk easily simulate an AFSM
problems@[EMAIL PROTECTED  2008-03-20 06:02:39 
Re: Re (3): Can awk easily simulate an AFSM
=?ISO-8859-1?Q?J=FCrgen_K  2008-03-20 20:28:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 3:23:25 CDT 2008.