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


Groups > comp.lang.forth > #54315

Re: Recognizers

From Alex <alex@rivadpm.com>
Newsgroups comp.lang.forth
Subject Re: Recognizers
Date 2017-01-23 14:45 -0500
Organization A noiseless patient Spider
Message-ID <o65md0$cnm$1@dont-email.me> (permalink)
References <o61k4o$9he$1@dont-email.me> <o650dq$lpb$1@dont-email.me> <be7b4efc-a0be-48b0-b185-d94bbc462f94@googlegroups.com>

Show all headers | View raw


On 1/23/2017 13:58, Matthias Trute wrote:
> Am Montag, 23. Januar 2017 14:30:08 UTC+1 schrieb Alex:
>> On 1/22/2017 01:42, Alex wrote:
>>> Some recognizer observations.
>>
>> Refer to http://amforth.sourceforge.net/pr/Recognizer-rfc-C.html
>>
>> 3. Having R:FAIL not on the recognizer stack is inflexible. When
>> supporting more than one stack, the same R:FAIL appears as the last
>> implied entry in all of them, and an action like -13 THROW may not be
>> right for every situation. E.g. I may want to support forward
>> definitions on "not found" rather than throw an error.
>
> R:FAIL is never on the stack, R:FAIL is a result of the actions.

My bad; I meant as a result of the recognizer stack. Let me play some 
more with recognizers & I may come back to this one.

> That R:FAIL is used to execute some actions is truly the
> "last resort" like an outermost exception catcher.
>
> adding a "not found" hook or a forward definition resolver as a
> recognizer is easily possible.

Yes, I see that.

>
>> 4. Varying stack item counts from REC:<name> words.
>>
>> This one has caused me a lot of grief while debugging.
>>
>> : rec:num ( addr u -- d r:num | r:fail )
>
> I'm sure you mean this stack effect(s)
>
>   : rec:num ( addr u -- n r:num | d r:dnum | r:fail)
>
> This word is part of the informal appendix, there are
> three different recognizers for each number format
> (single, double cell numbers and the 'x' notation)
> available at (among others)
>
> http://theforth.net/package/recognizers/current-view/rec-num.4th
>
> that have a clean stack effect.

No, I meant ( addr u -- d r:num | r:fail ), where success has 3 stack 
items and failure only the failure flag; all the REC:<name> words have 
that feature. Whether it's a problem longer erm I can't say, but it did 
cost me a number of hours while debugging a stack runaway & memory 
access issues some distance from the code. I was erroneously returning ( 
0 r:fail ) in some -- not all -- cases.

>> 5. Names.
>>
>> I haven't found a use for R>COMP R>INT or R>POST. Also, the names are a
>> little suspect; why not match NAME>X and have R>INTERPRET R>COMPILE and
>> R>POSTPONE (if they are required).
>
> NAME>x require a name token which may be not available (infact
> IMHO only very few forth's currently can have one. IMHO). There is
> currently a discussion with the gforth people about the DT>x words
> (as they are called now), maybe it's time to disclose the version
> 4 of the RFD. It addresses the name confusion like
>
>>
>> R:<name> (a table) and REC:<name> (a word) are too similar, and an
>> attempt has been made to semi-standardize them.
>>
>> RECOGNIZER would be clearer as RECOGNIZER-STACK
>
> too. Have a look at http://amforth.sourceforge.net/Recognizers.html
> for the details.
>

Ah, thanks. I've been working off V3.

> Matthias
>


-- 
Alex

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


Thread

Recognizers Alex <alex@rivadpm.com> - 2017-01-22 01:42 -0500
  Re: Recognizers Matthias Trute <matthias.trute@gmail.com> - 2017-01-22 03:06 -0800
  Re: Recognizers anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-22 14:42 +0000
    Re: Recognizers Alex <alex@rivadpm.com> - 2017-01-22 17:26 -0500
    Re: Recognizers Bernd Paysan <bernd@net2o.de> - 2017-01-24 00:57 +0000
      Re: Recognizers anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-24 16:23 +0000
        Re: Recognizers Bernd Paysan <bernd@net2o.de> - 2017-01-24 21:47 +0000
  Re: Recognizers Alex <alex@rivadpm.com> - 2017-01-23 08:30 -0500
    Re: Recognizers Alex <alex@rivadpm.com> - 2017-01-23 08:57 -0500
    Re: Recognizers Matthias Trute <matthias.trute@gmail.com> - 2017-01-23 10:58 -0800
      Re: Recognizers Alex <alex@rivadpm.com> - 2017-01-23 14:45 -0500
      Re: Recognizers JennyB <jennybrien@googlemail.com> - 2017-01-27 15:05 -0800
    Re: Recognizers Alex <alex@rivadpm.com> - 2017-01-29 22:54 +0000
      Re: Recognizers JennyB <jennybrien@googlemail.com> - 2017-01-30 09:11 -0800
      Re: Recognizers anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-01-30 16:34 +0000
  Re: Recognizers Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2017-01-31 21:03 +0000
    Re: Recognizers albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-02-01 12:37 +0100

csiph-web