Hi Darin,
On 12 Feb 98, 22:03, you wrote to Auke Reitsma
MS>>> Comment extraction is not as easy as one might first think.
...
DM> If one can get all the states of a C-parser into one's head,
... you won't have place for anything else ;-)
DM> eliminate 3/4 of them due to being irrelevant, and put them down
DM> into a state-graph, it quickly becomes simple. Tedious, but
DM> simple.
Yes. State-graphs are the way to go. Then use an FSM implementation.
See Snippets ...
Advantage: direct translation of the state table into code. Your sample
pseudo-code just might have a nearly invisible bug. ;-) Been there, done
hat.
Disadvantage: a bit slowish. And if you make a mistake in the code it might
produce garbage. Or lock up. (States without exit conditions.)
Greetings from
_____
/_|__| Auke Reitsma, Delft, The Netherlands.
/ | \ --------------------------------------
--- GEcho 1.00
---------------
* Origin: Home by the C (Auke.Reitsma@net.hcc.nl) (2:281/400.20)
|