Here's a little puzzle. What is the third example doing? state=: 3 2 2$ 1 1 2 1 1 1 2 2 (0;state;<a.={.a);: a=:' the quick brown fox jumps over the lazy dog' --T-T-T-T-T-T-T-T-┐ │e│k│n│x│s│r│e│y│g│ L-+-+-+-+-+-+-+-+-- state=: 3 2 2$ 1 1 2 1 1 2 2 2 (0;state;<a.={.a);: a=:' the quick brown fox jumps over the lazy dog' --T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-┐ │t│h│e│q│u│i│c│k│b│r│o│w│n│f│o│x│j│u│m│p│s│o│v│e│r│t│h│e│l│a│z│y│d│o│g│ L-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-- state=: 3 2 2$ 1 1 2 1 2 1 2 2 (0;state;<a.={.a);: a=:' the quick brown fox jumps over the lazy dog' --T-T-T-T-T-T-┐ │e│k│n│x│s│e│g│ L-+-+-+-+-+-+-- state=: 3 2 2$ 1 1 2 1 2 2 2 2 (0;state;<a.={.a);: a=:' the quick brown fox jumps over the lazy dog' --T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-┐ │t│e│q│i│k│b│o│n│f│x│j│m│s│o│e│t│e│l│z│d│g│ L-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-- Linda
-----Original Message----- From: programming-boun...@jsoftware.com [mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord Sent: Thursday, March 08, 2012 9:30 PM To: 'Programming forum' Subject: Re: [Jprogramming] Sequential Machine Roger, I'm not sure that this is what you had in mind. a=:'a good way to start the day' <;.1 a ---------T--------T---------T--┐ │a good w│ay to st│art the d│ay│ L--------+--------+---------+--- state=: 3 2 2$ 1 1 2 1 2 0 2 2 1 0 2 2 (0;state;<a.={.a);:a ---------T--------T---------T--┐ │a good w│ay to st│art the d│ay│ L--------+--------+---------+--- Linda -----Original Message----- From: programming-boun...@jsoftware.com [mailto:programming-boun...@jsoftware.com] On Behalf Of Roger Hui Sent: Monday, February 27, 2012 10:04 PM To: Programming forum Subject: Re: [Jprogramming] Sequential Machine Yes, and your mission, should you decide to accept it, is to program this function (let's say <;.1 y where ' '={.y) using the dyad ;: . 2012/2/27 Linda Alvord <lindaalv...@verizon.net> > Maybe this will get me going on a sequential machine. > <;.1 'a good way to start the day' > ---------T--------T---------T--┐ > │a good w│ay to st│art the d│ay│ > L--------+--------+---------+--- > < ;.1 'a good time was had by all' > --------------T----T------T---┐ > │a good time w│as h│ad by │all│ > L-------------+----+------+---- > < ;.2 'a good time was had by all' > --------------------------T-┐ > │a good time was had by al│l│ > L-------------------------+-- > < ;.0 'a good time was had by all' > ---------------------------┐ > │lla yb dah saw emit doog a│ > L--------------------------- > <;.2 'a good way to start the day' > -----------T-----------------┐ > │a good way│ to start the day│ > L----------+------------------ > <;.2 'a good way to start the day ' > ---T-----T----T---T------T----T----┐ > │a │good │way │to │start │the │day │ > L--+-----+----+---+------+----+----- > > > -----Original Message----- > From: programming-boun...@jsoftware.com > [mailto:programming-boun...@jsoftware.com] On Behalf Of Roger Hui > Sent: Monday, February 27, 2012 1:22 PM > To: Programming forum > Subject: Re: [Jprogramming] Sequential Machine > > The one thing that drove home for me the efficacy of the dyad ;:, is > that an implementation <;.1 y as a sequential machine was within a > factor of 2 (something like that) of the primitive <;.1 y. I > hand-coded the latter in C and devoted much effort to it. > > > > On Mon, Feb 27, 2012 at 9:49 AM, Raul Miller <rauldmil...@gmail.com> > wrote: > > > I went through the wiki, with a text search on sequential machine, > > looking for pages that might be of use here. > > > > The first page I examined (working up from the bottom on my list of > > plausible candidates) was > > > > > > > > http://www.jsoftware.com/jwiki/Guides/Language%20FAQ/J%20BNF?highlight > =%28se > quential%29%7C%28machine%29<http://www.jsoftware.com/jwiki/Guides/Lang > uage%20FAQ/J%20BNF?highlight=%28se%0Aquential%29%7C%28machine%29> > > > > This led me to it's "See Also" link: > > http://www.jsoftware.com/pipermail/chat/2007-November/000678.html > > > > And, I noticed there a statement by Oleg Kobchenko: > > > > J uses ... interpreter, which is a context-sensitive > > bottom-up table-driven parser/executor: > > http://www.jsoftware.com/help/dictionary/dicte.htm > > > > (which is obviosly not recursive-descent). > > > > And, from my point of view, this parser is obviously recursive descent. > > > > That said, the typical recursive descent parser is a left to right > > parser. This is what the "LR" in various parser acronyms stands for. > > J's parser is a right to left parser, so the parallel acronym would > > be "RL". [Technically, "LR" means "Left to right, producing a > > Rightmost derivation".] > > > > Secondly, most recursive descent parsers have "one token lookahead". > > I have thought in the past that J uses "four token lookahead", but > > this is not the case. J uses one token lookahead (only for > > assignment). Instead, J uses four token "lookbehind". > > > > Conceptually speaking, the J parser pops four tokens off the stack. > > But this is just a description of the internal state of the parser, > > and does not impact its status as a recursive descent parser. > > > > A person might argue that "RL" and "LR" are not logically > > equivalent, but I do not think that's relevant here. Ultimately, > > the parser sees a sequence of tokens and from an algorithmic point > > of view the meanings of "left" and "right" are implemented in > > another module (the one that breaks the input stream into words). > > But the lexer -- the module that breaks the input stream into words > > -- is not considered when classifying the parser. > > > > Anyways, I just had to get that off of my chest. > > > > Some pages which look maybe interesting for learning about > > sequential machines include (possibly in partially reversed order of relevance): > > > > http://www.jsoftware.com/jwiki/Essays/Huffman%20Coding > > > > http://www.jsoftware.com/jwiki/Essays/Regex%20Lexer > > > > http://www.jsoftware.com/jwiki/Guides/Parsing > > > > http://www.jsoftware.com/jwiki/SequentialMachine > > > > http://www.jsoftware.com/jwiki/JWebServer/HttpParser > > > > And, of course, the Sequential Machine lab is probably a very good > > resource to start with. > > > > -- > > Raul > > -------------------------------------------------------------------- > > -- For information about J forums see > > http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm