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


Groups > comp.lang.forth > #56811

Recognizers & EVALUATE recursion

From Alex <alex@rivadpm.com>
Newsgroups comp.lang.forth
Subject Recognizers & EVALUATE recursion
Date 2017-04-07 14:59 +0100
Organization A noiseless patient Spider
Message-ID <oc85qd$t56$1@dont-email.me> (permalink)

Show all headers | View raw


Using EVALUATE or allowing an implicit use of EVALUATE in the execution 
path of a recognizer may cause problems. In my Forth (edited for clarity):

: interpreter ( -- )
     begin parse-name dup
     while default-recognize execute
     repeat 2drop ;

: evaluate ( addr len -- )
     ['] interpreter execute-parsing ;

A recognizer using EVALUATE re-drives the interpreter, and hence the 
recognizer is potentially recursed into.

Not every parse will cause issues, but there are certain pathological 
cases where the recogniser may infinitely recurse. In my case it was an 
EVALUATE for :NAME causing an EVALUATE for :NAME ... and so on.

-- 
Alex

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


Thread

Recognizers & EVALUATE recursion Alex <alex@rivadpm.com> - 2017-04-07 14:59 +0100
  Re: Recognizers & EVALUATE recursion Matthias Trute <matthias.trute@gmail.com> - 2017-04-07 08:12 -0700
    Re: Recognizers & EVALUATE recursion Alex <alex@rivadpm.com> - 2017-04-09 22:39 +0100
  Re: Recognizers & EVALUATE recursion anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-04-08 14:17 +0000
    Re: Recognizers & EVALUATE recursion Alex <alex@rivadpm.com> - 2017-04-09 22:37 +0100

csiph-web