Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

Michael Torrie torriem at gmail.com
Sat Mar 17 19:28:38 EDT 2012


On 03/17/2012 11:55 AM, Kiuhnm wrote:
> Why should I write a treatise on decompilation techniques on this ng?

You were the one that said simply, you're doing it wrong followed by a
terse statement, do it like a decompiler.  I am familiar with how one
might implement a decompiler, as well as a compiler (having written a
simple one in the past), but even now I don't see a connection between a
decompiler and the process of converting a knuth algorithm into a python
python implementation.  I was hoping you would shed some light on that.
 But alas, I'm not really as much of an "interested reader" as you would
like me to be.

>> Saying, "be like a decompiler" doesn't say anything.
> That looks like a glaring contradiction to me...

True, if you wish to be pedantic.  I should have said, "meaningless," or
at least, "not a useful response."

> Here's an example of rewriting:
> <snip>

Thank you.  Your example makes more clear your assertion about "labels"
and how really A1 and A5 were the only real labels in the example.
Though I still do not really see why "states" is not a good equivalence
for labels in this case.  As well, Roy's idea for doing the state
machines, which works equally well as the nested if statements, is more
pythonic, which is generally preferred in Python.




More information about the Python-list mailing list