In article <64agc9F2b555cU1@[EMAIL PROTECTED]
>,
=?ISO-8859-1?Q?J=FCrgen_Kahrs?= <Juergen.KahrsDELETETHIS@[EMAIL PROTECTED]
> wrote:
> problems@[EMAIL PROTECTED]
wrote:
>
> > OK, apparently "Encode" is the code generation.
> > Since I haven't worked with my stuff for many years,
> > I only now realise that awk would give me a program
> > driven implementation, rather than a data-driven AFSM,
> > which is what I want.
>
> AWK can do both. The example I gave was
> an implementation similar to C style.
> If you really want it data-driven, you
> can have it in AWK (few users prefer this
> style).
>
> > Apparently I need first to get familiar with *nix regex to
> > clean-up my fetched texts ?
>
> It helps, but you can also get along without
> too much regexp if you want.
>
> > Apparently my ideas of an AFSM compiler is closer to the
> > table-driven compilers ?
>
> I wouldnt say it this way. I was only surprised
> that you would prefer the data-driven style.
> A data-driven implementation in canonic AWK may
> look like this:
>
> BEGIN { state = "" }
>
> state == "" && /IF/ { state = "IF" ; Encode(...) }
> state == "IF" && /ELSE/ { state = "ELSE" ; Encode(...) }
>
OK.
You know there's p2c: translating pascal to c-code; but no c2p.
I'd like to hack one even if it couldn't give compilable code -
a bit like the old babblefish translator.
Any thing that reduces the work load of routine tasks and just
leaves the final complex details for human tweeking is usefull.
Apparently there's a "standard" perl regex-engine open source
implementation. The regex tools of ETH-oberon whaich I use
are not too good. I guess the "standard" perl one has been tested
a million times ?
I once built a minimum assembler for some 68/3xx 8-bit processor,
where I used my prefered [more descriptive IMO] mnemonics:
#3 -> A; instead of eg. movi #3, a and
[B] -> Port1 ; instead of eg. outport 1, b
Perhaps I just used some big nested case statements, but for tasks
like this, if you've got the syntax diagram on a big sheet of paper,
then re-arranging it with all the nodes on the left, translates
naturally to a data-driven [perhaps awk] implementation.
The thinking is done on the [perhaps paper] 'node-map', and
the awk-code would be just an implementation of the node-map.
== Chris Glur.


|