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

2012-03-19 Thread Kiuhnm
On 3/19/2012 6:02, Dennis Lee Bieber wrote: On Mon, 19 Mar 2012 02:02:23 +0100, Kiuhnm declaimed the following in gmane.comp.python.general: Many ASM languages don't have structured control flow statements but only jmps, which are roughly equivalent to gotos. A good decompiler will need to a

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

2012-03-18 Thread Kiuhnm
On 3/18/2012 0:28, Michael Torrie wrote: 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 implem

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

2012-03-18 Thread Albert van der Horst
In article , Antti J Ylikoski wrote: > >In his legendary book series The Art of Computer Programming, >Professor Donald E. Knuth presents many of his algorithms in the form >that they have been divided in several individual phases, with >instructions to GOTO to another phase interspersed in the t

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

2012-03-18 Thread Albert van der Horst
In article <4f654042$0$29981$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: >On Sat, 17 Mar 2012 17:28:38 -0600, Michael Torrie wrote: > >> 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. >>

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

2012-03-17 Thread Evan Driscoll
On 3/17/2012 9:03, Antti J Ylikoski wrote: > > In his legendary book series The Art of Computer Programming, > Professor Donald E. Knuth presents many of his algorithms in the form > that they have been divided in several individual phases, with > instructions to GOTO to another phase interspersed

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

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 17:28:38 -0600, Michael Torrie wrote: > 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 ca

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

2012-03-17 Thread Michael Torrie
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 comp

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

2012-03-17 Thread John Nagle
On 3/17/2012 9:31 AM, Antti J Ylikoski wrote: On 17.3.2012 17:47, Roy Smith wrote: In article, Antti J Ylikoski wrote: I came across the problem, which would be the clearest way to program such algorithms with a programming language such as Python, which has no GOTO statement. Oh, my, I can't

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

2012-03-17 Thread Kiuhnm
On 3/17/2012 16:53, Michael Torrie wrote: > On 03/17/2012 09:12 AM, Kiuhnm wrote: >> On 3/17/2012 16:01, Michael Torrie wrote: >>> On 03/17/2012 08:45 AM, Kiuhnm wrote: Your way is easy, but the result is poor. >>> >>> In what way? >> >> The resulting code is inefficient, difficult to comprehe

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

2012-03-17 Thread Antti J Ylikoski
On 17.3.2012 17:47, Roy Smith wrote: In article, Antti J Ylikoski wrote: I came across the problem, which would be the clearest way to program such algorithms with a programming language such as Python, which has no GOTO statement. It struck me that the above construction actually is a modi

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

2012-03-17 Thread Michael Torrie
On 03/17/2012 09:12 AM, Kiuhnm wrote: > On 3/17/2012 16:01, Michael Torrie wrote: >> On 03/17/2012 08:45 AM, Kiuhnm wrote: >>> Your way is easy, but the result is poor. >> >> In what way? > > The resulting code is inefficient, difficult to comprehend and to mantain. > >> What is your recommended

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

2012-03-17 Thread Roy Smith
In article , Antti J Ylikoski wrote: > I came across the problem, which would be the clearest way to program > such algorithms with a programming language such as Python, which has > no GOTO statement. It struck me that the above construction actually > is a modified Deterministic Finite Automa

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

2012-03-17 Thread Kiuhnm
On 3/17/2012 16:01, Michael Torrie wrote: On 03/17/2012 08:45 AM, Kiuhnm wrote: Your way is easy, but the result is poor. In what way? The resulting code is inefficient, difficult to comprehend and to mantain. What is your recommended way? One should rewrite the code. There is a reason w

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

2012-03-17 Thread Michael Torrie
On 03/17/2012 08:45 AM, Kiuhnm wrote: > Your way is easy, but the result is poor. In what way? What is your recommended way? > Your should try to rewrite it. > Decompilers do exactly that. Decompilers rewrite code for people? That's really neat. -- http://mail.python.org/mailman/listinfo/pyt

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

2012-03-17 Thread Kiuhnm
On 3/17/2012 15:03, Antti J Ylikoski wrote: In his legendary book series The Art of Computer Programming, Professor Donald E. Knuth presents many of his algorithms in the form that they have been divided in several individual phases, with instructions to GOTO to another phase interspersed in the

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

2012-03-17 Thread Mel Wilson
Antti J Ylikoski wrote: > > In his legendary book series The Art of Computer Programming, > Professor Donald E. Knuth presents many of his algorithms in the form > that they have been divided in several individual phases, with > instructions to GOTO to another phase interspersed in the text of th

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

2012-03-17 Thread Antti J Ylikoski
In his legendary book series The Art of Computer Programming, Professor Donald E. Knuth presents many of his algorithms in the form that they have been divided in several individual phases, with instructions to GOTO to another phase interspersed in the text of the individual phases. I. e. they