Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #54452

Re: Recognizers and LOCATE

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Recognizers and LOCATE
Date 2017-01-27 09:10 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017Jan27.101029@mips.complang.tuwien.ac.at> (permalink)
References <Hd2dnfK32o-9AhrFnZ2dnUU7-bHNnZ2d@supernews.com> <2017Jan26.125252@mips.complang.tuwien.ac.at> <urWdnUJubp0_mBfFnZ2dnUU7-dXNnZ2d@supernews.com> <2017Jan26.172625@mips.complang.tuwien.ac.at> <udGdnbkweYIOrBfFnZ2dnUU7-f_NnZ2d@supernews.com>

Show all headers | View raw


Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>> : f1+ 1e f+ ;  ok
>>>> locate 1e 1e Can't be located
>>>>
>>>> Panic!  The system must be broken!
>>>
>>>Oh, no.  I should have predicted that response.  :-(
>>>
>>>Obviously the maintenace programmer is a Forth programmer, and knows
>>>what a number is.

Actually, the idea of the programmer and of the system's number
recognizer may differ:

SwiftForth i386-Linux 3.4.8a 21-Jul-2013 
1. 2,  ok
locate 2, 2, Can't be located

A common case for beginners is "1.0" and "1.".

In both cases, while looking at the specific misinterpreted word would
unravel the issue, the problem is that it typically hides among lots
of other words, that the user has no idea that misinterpretation is
the problem, and that if he knew, he would have little idea which word
is misinterpreted.  So the actual resolution is typically the use of
.s or ~~ in various places until one has zeroed in on the culprit.

>> I expect that maintainence programmers will also be familiar with the
>> recognizers used in the programs they maintain.
>
>Ah.  That's a huge mistake.  I have many times been called to a site
>where a mysterious Forth program is malfunctioning, sometimes in very
>difficult circumstances.

Then if LOCATE reports an error, you will know that the word is not a
definition (or, on some systems, it might be a beheaded definition),
and you know it's time to look at the recognizers loaded into the
system.  Or you have more comfortable system where LOCATE actually
reports the recognizer that recognizes the word.

>>>That's not what I meant.  A recognizer might andvance >IN beyond the
>>>initial parsed word, and indeed the RFC mentions this possibility.
>> 
>> Yes, and I gave an example (the only one known) where that comes into
>> play.  Here it is again, for more diligent consideration:
>> 
>> |"abc def" type abc def ok
>> |locate "abc def" 
>> |quotedstring.fs:24:3
>> |...
>> |*   24: : rec:string ( addr u -- addr u' r:string | r:fail )
>> |...
>> 
>> Now what would happen if >IN would be restored to point right before
>> 'def"'?
>
>I don't get it.  Why would anybody type 
>
>  locate "abc def" 

Why wouldn't they?  When you see

"abc def" type

it's quite obvious that '"abc def"' belong together.  And if you
belong to those who think that "abc and def" are separate words, well,
let's see:

locate "abc 
quotedstring.fs:24:3
...
*   24: : rec:string ( addr u -- addr u' r:string | r:fail )
...

Works, too.  And if you complain that

locate "abc 1 .

will do something other than you claim you expect: I will not take
this complaint seriously unless you have filed a bug report for the
SwiftForth implementation of WORDS, which not only parses (unlike the
standard WORDS), but also does not show all the words in the wordlist
if it is followed by something in the same line.  Example:

words 123 . -4 Stack underflow

In this reality, however, both LOCATE and WORDS are not followed by
unrelated stuff on the same line, that's why nobody complains about
SwiftForth's WORDS, and that's why parsing by the recognizer during
LOCATE is a good thing.  Either the user does not see that "abc def"
belongs together, and then he will type

LOCATE "abc

and will get the correct answer, or they see that "abc def" belongs
together, and then he will type

locate "abc def"

and will get the correct answer.  The case you worry about so much,
e.g.,

locate "abc 123 .

does not happen in practice, just like

words 123 .

does not happen in practice.

>>>Other side effetcs are possible.
>> 
>> Such as?
>
>Anything.  I don't think that the proposal restricts what user-defined
>recognizers can do, does it?

No, this is Forth, the programmer is responsible.  But apparently not
even you can think of a scenario where this would be a problem.  And
there is a reason for that: The use of recognizers in text
interpreters is in sequences like

recognize r>interpret execute
recognize r>compile execute
recognize r>postpone execute

so any wanted side effect can be and are effected through the EXECUTE
in this sequence.

>>>It's not intended to be a disruptive tactic.  I'm engaging with the
>>>proposal in a positive way, by pointing out how it might be improved.
>> 
>> Maybe you are.  That does not mean that the end result is not the
>> same.
>
>Well, sorry.  I can't help that.  

Sure you can.  You can examine the supposed problems you raise and
reality-check them.  Then you, like me, would have found that they are
pure fantasy.  Next, ask yourself whether it is a good idea to make a
fuss over fantasy problems.  Then you can examine the proposal further
and maybe find some real problems or real improvements.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2016: http://www.euroforth.org/ef16/

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-24 12:38 -0600
  Recognizers and LOCATE JennyB <jennybrien@googlemail.com> - 2017-01-24 10:56 -0800
    Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-01-24 22:25 +0000
      Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-25 03:16 -0600
        Re: Recognizers and LOCATE JennyB <jennybrien@googlemail.com> - 2017-01-25 08:37 -0800
          Re: Recognizers and LOCATE Alex <alex@rivadpm.com> - 2017-01-25 14:22 -0500
            Re: Recognizers and LOCATE Alex <alex@rivadpm.com> - 2017-01-25 14:26 -0500
            Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-01-25 11:49 -0800
              Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-26 03:33 -0600
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-01-26 10:14 -0800
                Re: Recognizers and LOCATE JennyB <jennybrien@googlemail.com> - 2017-01-26 11:04 -0800
            Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-01-26 01:24 +0000
              Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-26 06:26 -0600
                Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-03-12 00:47 +0000
                Re: Recognizers and LOCATE albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-03-12 17:01 +0100
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-03-13 12:31 -0700
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-03-14 04:51 -0500
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-03-14 12:48 -0700
              Re: Recognizers and LOCATE Alex <alex@rivadpm.com> - 2017-01-27 17:18 +0000
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-01-27 09:28 -0800
                Re: Recognizers and LOCATE Alex <alex@rivadpm.com> - 2017-01-27 17:35 +0000
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-01-28 04:29 -0800
        Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-01-25 21:07 +0000
          Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-26 11:24 +0000
            Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-26 06:23 -0600
              Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-26 15:39 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-26 11:14 -0600
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-27 08:37 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-27 03:26 -0600
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-27 11:37 +0000
                Re: Recognizers and LOCATE stephen@mpeforth.com (Stephen Pelc) - 2017-01-27 17:28 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-28 04:22 -0600
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-01-28 04:35 -0800
                Re: Recognizers and LOCATE JennyB <jennybrien@googlemail.com> - 2017-01-28 07:03 -0800
                Re: Recognizers and LOCATE Matthias Trute <matthias.trute@gmail.com> - 2017-01-28 07:42 -0800
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-28 17:25 +0000
                Re: Recognizers and LOCATE peter.m.falth@gmail.com - 2017-01-28 08:05 -0800
                Re: Recognizers and LOCATE JennyB <jennybrien@googlemail.com> - 2017-01-28 09:27 -0800
                Re: Recognizers and LOCATE albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-28 19:18 +0100
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-29 04:35 -0600
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-29 16:59 +0000
                Re: Recognizers and LOCATE albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-29 19:40 +0100
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-31 17:01 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-31 04:12 -0600
                Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-03-12 01:25 +0000
                Re: Recognizers and LOCATE minforth@arcor.de - 2017-03-12 01:30 -0800
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-12 10:07 +0000
                Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-03-15 23:30 +0000
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-16 11:59 +0000
                Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-03-17 21:46 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-03-12 06:51 -0500
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-12 13:05 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-03-12 12:04 -0500
  Re: Recognizers and LOCATE albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-24 20:41 +0100
  Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-26 11:52 +0000
    Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-26 08:20 -0600
      Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-26 16:26 +0000
        Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-26 11:27 -0600
          Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-27 09:10 +0000
            Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-27 09:59 -0600
              Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-27 16:16 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-28 04:35 -0600
                Re: Recognizers and LOCATE albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-28 19:41 +0100
                Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-29 16:18 +0000
                Re: Recognizers and LOCATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-01-31 04:21 -0600
                Re: Recognizers and LOCATE Bernd Paysan <bernd@net2o.de> - 2017-03-12 01:07 +0000
    Re: Recognizers and LOCATE albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-01-26 21:08 +0100
      Re: Recognizers and LOCATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-27 10:13 +0000

csiph-web