recognizers
A collection of recognizers
\
\ Purpose: Dictionary lookup recognizer based on Forth CORE (only?)
\
\ Author: Matthias Trute
\ Date: Jan 28, 2017
\ License: Public Domain
\ find-word is close to FIND but takes addr/len as input
: BUFFER: CREATE ALLOT ;
256 BUFFER: find-word-buf
: find-word ( addr len -- xt +/-1 | 0 )
find-word-buf place find-word-buf
FIND DUP 0= IF NIP THEN ;
:NONAME ( i*x XT flags -- j*y ) \ INTERPRET
DROP EXECUTE ;
:NONAME ( XT flags -- ) \ COMPILE
0> IF COMPILE, ELSE EXECUTE THEN ;
:NONAME POSTPONE 2LITERAL ; ( XT flag -- )
DT-TOKEN: DT:XT
: REC:FIND ( addr len -- XT flags DT:XT | DT:NULL )
find-word ( addr len -- XT flags | 0 )
?DUP IF DT:XT ELSE DT:NULL THEN
;
T{ S" DUP" REC:FIND -> ' DUP -1 DT:XT }T
T{ S" UNKOWN WORD" REC:FIND -> DT:NULL }T
by mtrute
Versions
2.1.0, 2.0.0, 1.4.5, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0.0
Download current as zip
Tags
recognizer, recognizerstack, stack
Dependencies
ttester 1.x.x, stack 1.x.x
Dependents
None