Recognizer protocol (was: 0 SET-ORDER why?)

Liste des GroupesRevenir à cl forth 
Sujet : Recognizer protocol (was: 0 SET-ORDER why?)
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forth
Date : 28. Jun 2024, 23:27:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v5ndch$3d9d8$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 2024-06-28 23:45, albert@spenarnc.xs4all.nl wrote:
In article <v5m2po$3811n$2@dont-email.me>,
Ruvim  <ruvim.pinka@gmail.com> wrote:
On 2024-06-27 08:14, Gerry Jackson wrote:
[...]
A corrected variant:
>
   : s-to-n ( addr u -- x )
     depth >r
     get-order n>r 0 set-order
       ['] evaluate ['] execute-interpreting catch
     nr> set-order  throw
     depth 1+ r> <> if -12 throw then
   ;
>
>
>
This is a better use case e.g. if BASE is greater than decimal 10
converting an alphanumeric string to a number could clash with a word in
the dictionary. Having an empty search order eliminates that possibility.
>
Incidentally another possibility is that if ['] EVALUATE is replaced in
the above definition with ['] SOME-RECOGNISER, that could be the basis
for an ANS/FORTH 2012 compatible way of implementing recognisers. If the
recogniser fails restore the search order and try again.
>
>
My position is that no recognizer can have side effects (other then
items on the data stack and/or floating-point stack).

I second that.
My rationale:
   "Recognizer protocol", 2020-07-04
   <news:rdpu54$pfn$1@dont-email.me>
<https://groups.google.com/g/comp.lang.forth/c/yuNZEvq8EqA/m/-FcvRcwRAQAJ>

Moreover the items would have to be the same in
interpret and compilation mode.
Agreed.
Rationale:
1. In most use cases the result of recognizing does not depend on STATE
(and when it depends, like in cmForth, it can be made independent).
2. One useful thing about recognizers is that they can be used for more than just the purpose of lexeme translation. If we would need to only translate lexemes (i.e., to compile or interpret a lexeme depending on STATE) — no need to separate the step of recognizing.
3. If we recognize a lexeme not for further immediate translation, and the result may depend on STATE, we will need to change STATE before recognizing (or use some helpers to indicate our intention). This only complicates some use cases and does not simplify anything.

At least as a starting point, otherwise Forth degenerates to a
tangled web of special purpose interpreters.
--
Ruvim

Date Sujet#  Auteur
26 Jun 24 * 0 SET-ORDER why?64Krishna Myneni
26 Jun 24 +* Re: 0 SET-ORDER why?3minforth
26 Jun 24 i+- Re: 0 SET-ORDER why?1albert
26 Jun 24 i`- Re: 0 SET-ORDER why?1Krishna Myneni
26 Jun 24 `* Re: 0 SET-ORDER why?60Anton Ertl
26 Jun 24  +* Re: 0 SET-ORDER why?26dxf
26 Jun 24  i`* Re: 0 SET-ORDER why?25Ruvim
27 Jun 24  i +* Re: 0 SET-ORDER why?9dxf
27 Jun 24  i i+* Re: 0 SET-ORDER why?2Gerry Jackson
28 Jun 24  i ii`- Re: 0 SET-ORDER why?1dxf
28 Jun 24  i i`* Re: 0 SET-ORDER why?6Ruvim
28 Jun 24  i i +* Re: 0 SET-ORDER why?4dxf
28 Jun 24  i i i`* Re: 0 SET-ORDER why?3Ruvim
28 Jun 24  i i i `* Re: 0 SET-ORDER why?2dxf
1 Jul 24  i i i  `- Re: 0 SET-ORDER why?1dxf
29 Jun 24  i i `- Re: 0 SET-ORDER why?1dxf
27 Jun 24  i `* Re: 0 SET-ORDER why?15Gerry Jackson
27 Jun 24  i  +* Re: 0 SET-ORDER why?2albert
27 Jun 24  i  i`- Re: 0 SET-ORDER why?1minforth
27 Jun 24  i  +- Re: 0 SET-ORDER why?1dxf
27 Jun 24  i  +* Re: 0 SET-ORDER why?7Krishna Myneni
27 Jun 24  i  i+* Re: 0 SET-ORDER why?4Krishna Myneni
27 Jun 24  i  ii+* Re: 0 SET-ORDER why?2Gerry Jackson
28 Jun 24  i  iii`- Re: 0 SET-ORDER why?1Krishna Myneni
28 Jun 24  i  ii`- Re: 0 SET-ORDER why?1dxf
29 Jun 24  i  i`* Re: 0 SET-ORDER why?2Krishna Myneni
30 Jun 24  i  i `- Re: 0 SET-ORDER why?1albert
28 Jun 24  i  `* Re: 0 SET-ORDER why?4Ruvim
28 Jun 24  i   +* Re: 0 SET-ORDER why?2albert
28 Jun 24  i   i`- Recognizer protocol (was: 0 SET-ORDER why?)1Ruvim
4 Jul 24  i   `- Re: 0 SET-ORDER why?1Gerry Jackson
26 Jun 24  +* Re: 0 SET-ORDER why?3albert
26 Jun 24  i+- Re: 0 SET-ORDER why?1minforth
26 Jun 24  i`- Re: 0 SET-ORDER why?1Krishna Myneni
26 Jun 24  `* Re: 0 SET-ORDER why?30Krishna Myneni
28 Jun 24   `* Re: 0 SET-ORDER why?29Anton Ertl
28 Jun 24    +- Re: 0 SET-ORDER why?1Hans Bezemer
29 Jun 24    `* Re: 0 SET-ORDER why?27Krishna Myneni
30 Jun 24     `* Re: 0 SET-ORDER why?26dxf
30 Jun 24      `* Re: 0 SET-ORDER why?25Krishna Myneni
30 Jun 24       `* Re: 0 SET-ORDER why?24Krishna Myneni
30 Jun 24        `* Re: 0 SET-ORDER why?23minforth
30 Jun 24         `* Re: 0 SET-ORDER why?22Krishna Myneni
30 Jun 24          `* Re: 0 SET-ORDER why?21minforth
1 Jul 24           `* Re: 0 SET-ORDER why?20Krishna Myneni
1 Jul 24            +* Re: 0 SET-ORDER why?2mhx
1 Jul 24            i`- Re: 0 SET-ORDER why?1Krishna Myneni
1 Jul 24            `* Re: 0 SET-ORDER why?17Ruvim
1 Jul 24             +* Re: 0 SET-ORDER why?12Krishna Myneni
1 Jul 24             i+* Re: 0 SET-ORDER why?6dxf
2 Jul 24             ii+- Re: 0 SET-ORDER why?1dxf
3 Jul 24             ii`* Re: 0 SET-ORDER why?4Krishna Myneni
3 Jul 24             ii `* Re: 0 SET-ORDER why?3dxf
3 Jul 24             ii  `* Re: 0 SET-ORDER why?2albert
3 Jul 24             ii   `- Re: 0 SET-ORDER why?1dxf
1 Jul 24             i+* Re: 0 SET-ORDER why?3albert
2 Jul 24             ii`* Re: 0 SET-ORDER why?2sjack
2 Jul 24             ii `- Re: 0 SET-ORDER why?1dxf
2 Jul 24             i`* Re: 0 SET-ORDER why?2Ruvim
3 Jul 24             i `- Re: 0 SET-ORDER why?1Krishna Myneni
21 Sep 24             `* Re: 0 SET-ORDER why?4Anthony Howe
22 Sep 24              `* Re: 0 SET-ORDER why?3Ruvim
22 Sep 24               `* Re: 0 SET-ORDER why?2Anthony Howe
22 Sep 24                `- Re: 0 SET-ORDER why?1Ruvim

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal