Thanks for the references.  However, it turns out that I have been somewhat
familiar with an RL shift-reduce parser.

Out of curiosity, I tried to shed some ligth.  First with the trace
facility,

  trace'5}'
 --------------- 3 Adverb -----
 5
 }
 5}
 ==============================

   trace'5"'
 --------------- 6 Bident -----
 5
 "
 5"
 ==============================

It did not help me much.  Just in case, I tried the verb which started this
thread,

   ( S=. '(<(<,'':''),<(<(,''0'');1),<(,''0'');1 0$'''') (1 : ''u u`:6`:6
y'')' )
(<(<,':'),<(<(,'0');1),<(,'0');1 0$'') (1 : 'u u`:6`:6 y')

   trace S
 --------------- 4 Conj -------
 1
  :
 'u u`:6`:6 y'
 1 : 'u u`:6`:6 y'
.
.
.

 --------------- 8 Paren ------
 (
 <(<,':'),<(<(,'0');1),<(,'0');1 0$''
 )
 ┌────────────────┐
 │┌─┬────────────┐│
 ││:│┌─────┬────┐││
 ││ ││┌─┬─┐│┌─┬┐│││
 ││ │││0│1│││0│││││
 ││ ││└─┴─┘│└─┴┘│││
 ││ │└─────┴────┘││
 │└─┴────────────┘│
 └────────────────┘
 --------------- 3 Adverb -----
 <(<,':'),<(<(,'0');1),<(,'0');1 0$''
 1 : 'u u`:6`:6 y'
 <(<,':'),<(<(,'0');1),<(,'0');1 0$'' (1 : 'u u`:6`:6 y')
 ==============================
|syntax error: trace
|       <(<,':'),<(<(,'0');1),<(,'0');1 0$''(1 :'u u`:6`:6 y')

but at the crucial moment trace got bitten by the bug!  :)

(It was a long shot but I aimed for an updated j808 DLL on the
System/Installation/Zips page,

   https://code.jsoftware.com/wiki/System/Installation/Zips

but I got only broken links (which presumably they will be operating in the
future).)

Alright then, can Marshall's formal parser,

  https://code.jsoftware.com/wiki/User:Marshall_Lochbaum/Formal_Parser

help?

   parse@:splitwords'5}'
┌─────────────────┐
│┌─┬─────┬───────┐│
││1│┌─┬─┐│┌─────┐││
││ ││2│}│││┌─┬─┐│││
││ │└─┴─┘│││0│5││││
││ │     ││└─┴─┘│││
││ │     │└─────┘││
│└─┴─────┴───────┘│
└─────────────────┘
   parse@:splitwords'5"'
┌──────────────────────────┐
│┌─┬────────┬─────────────┐│
││1│┌─┬────┐│┌─────┬─────┐││
││ ││3│hook│││┌─┬─┐│┌─┬─┐│││
││ │└─┴────┘│││3│"│││0│5││││
││ │        ││└─┴─┘│└─┴─┘│││
││ │        │└─────┴─────┘││
│└─┴────────┴─────────────┘│
└──────────────────────────┘

I still did not see why 5} can be considered to be reduced but 5" is not
(incidentally, "bident" instead of "hook" would be a better word in this
case, among other things).

How about the troublesome sentence S?

   parse@:splitwords S

(I am skipping the output because it would look too messy in the archive;
but, the resulting tree is shallow.)

You mentioned the stack and a reducing the number of items in the parse
representation and I finally remembered Roger Stokes' excellent Evaluation
in Slow Motion (EVM),

   '5}'EVM
5}
┌─┬─┐
│5│}│
└─┴─┘
   hist''

 Queue        Stack               Rule

 ┌────────┐   ┌──────┬────┬───┐   ┌────┐
 │mark 5 }│   │      │    │   │   │    │
 ├────────┤   ├──────┼────┼───┤   ├────┤
 │mark 5  │   │ }    │    │   │   │    │
 ├────────┤   ├──────┼────┼───┤   ├────┤
 │mark    │   │ 5    │ }  │   │   │    │
 ├────────┤   ├──────┼────┼───┤   ├────┤
 │        │   │ mark │ 5  │ } │   │adv │
 ├────────┤   ├──────┼────┼───┤   ├────┤
 │        │   │ mark │ 5} │   │   │    │
 └────────┘   └──────┴────┴───┘   └────┘

   '5"'EVM
5"
┌─┬─┐
│5│"│
└─┴─┘
   hist''

 Queue        Stack               Rule

 ┌────────┐   ┌──────┬────┬───┐   ┌──────┐
 │mark 5 "│   │      │    │   │   │      │
 ├────────┤   ├──────┼────┼───┤   ├──────┤
 │mark 5  │   │ "    │    │   │   │      │
 ├────────┤   ├──────┼────┼───┤   ├──────┤
 │mark    │   │ 5    │ "  │   │   │      │
 ├────────┤   ├──────┼────┼───┤   ├──────┤
 │        │   │ mark │ 5  │ " │   │bident│
 ├────────┤   ├──────┼────┼───┤   ├──────┤
 │        │   │ mark │ 5" │   │   │      │
 └────────┘   └──────┴────┴───┘   └──────┘

I must be blind, I cannot see the difference; they look eerily similar to
me.  Right, the adv rule reduces the number of items in the stack; but, so
does the bident rule.

The bad news (for me) is that I am still in the dark.  The good news is
that I can safely assume that knowing the difference is irrelevant for
programming which could suggest moving any potential additional discussion
on this particular topic to the chat forum.

P.S.  I find the history of '(<(<,'':''),<(<(,''0'');1),<(,''0'');1 0$'''')
(1 : ''u u`:6`:6 y'')'EVM quite interesting.


On Wed, Dec 12, 2018 at 11:35 AM Raul Miller <rauldmil...@gmail.com> wrote:

> Here's a more concise explanation:
>
> In http://www.jsoftware.com/help/dictionary/dicte.htm the phrase "and
> eventually executing some eligible portion of the stack and replacing
> it by the result of the execution" describes the same thing that
> "reduce" describes what "reduce" would be in a shift-reduce parser
> explanation.  Basically, that "reduce" might also be described as "a
> step of evaluation".
>
> "Shifting", on the other hand, is taking another token (or word) from
> the parsing queue - that's another kind of evaluation step, but it
> doesn't reduce the number of items in the parse representation.
>
> But it really helps if you see it in action - it's such a simple
> concept that it's slippery to think about if you never see it
> happening.
>
> (Perhaps also worth noting that verb definitions are only extracted
> from their name during J's "parser reduce" steps while other named
> entities have their names extracted from their names during J's
> "parser shift"? This is an important distinction because of how
> locales are implemented, and it's also why undefined names are treated
> like verbs in tacit definitions, That said, note that names are not
> always undefined and this can be a source of confusion when using a
> script with forward verb references.)
>
> Thanks,
>
> --
> Raul
> On Wed, Dec 12, 2018 at 11:18 AM Raul Miller <rauldmil...@gmail.com>
> wrote:
> >
> > These look like decent explanations:
> >
> > http://www.cs.binghamton.edu/~zdu/parsdemo/srintro.html
> >
> > or, if you prefer a video presentation:
> >
> > https://www.youtube.com/watch?v=Ga9b_E85Lwc
> >
> > Mind you, the examples are for parsers left-to-right parsers
> > (indicated by LR in the alphabet soup used to label the things), while
> > J's parser is a right-to-left parser (which would probably be labeled
> > by RL along with some other bits of alphabet soup to describe the four
> > token pattern matching that it uses to decide what reduce action to
> > take).
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Wed, Dec 12, 2018 at 10:55 AM Jose Mario Quintana
> > <jose.mario.quint...@gmail.com> wrote:
> > >
> > > Why?  Can you elaborate?
> > >
> > > On Wed, Dec 12, 2018 at 10:07 AM Raul Miller <rauldmil...@gmail.com>
> wrote:
> > >
> > > > Yes.
> > > >
> > > > Thanks,
> > > >
> > > > —
> > > > Raul
> > > >
> > > >
> > > > On Tuesday, December 11, 2018, Jose Mario Quintana <
> > > > jose.mario.quint...@gmail.com> wrote:
> > > >
> > > > > It seems to be just academic now.  Nevertheless, does your
> interpretation
> > > > > imply that,
> > > > >
> > > > >    5"
> > > > > 5"
> > > > >
> > > > > is not "reduced" but,
> > > > >
> > > > >    5}
> > > > > 5}
> > > > >
> > > > > is "reduced" in the context of shift-reduce parsers?
> > > > >
> > > > >
> > > > > On Mon, Dec 10, 2018 at 10:43 AM Raul Miller <
> rauldmil...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > On Fri, Dec 7, 2018 at 7:53 PM Henry Rich <henryhr...@gmail.com>
> > > > wrote:
> > > > > > > What Ken meant by "resolve" is not clear to me.
> > > > > >
> > > > > > I expect he meant what people working with shift-reduce parsers
> would
> > > > > > call "reduce". (But Ken would not be inclined to call it that, I
> > > > > > imagine, because reduce was a similar/different well defined APL
> > > > > > operation.)
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > --
> > > > > > 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

Reply via email to