Hi again,

so I keep lugging away at trying to understand recognizers. I tried
loading the rec-double-paren.frt example. However, even after
adjusting the words from V3 to V4 it still falls over at the last line
shown below. The terminal simply goes dead and I have to reflash the
chip.

Have I missed changing something? I have load all the dependencies and
no errors up until that point occur.

Kind regards
Richard


\ keep the previously active forth-recognizer stack
variable old-f-rs
wordlist constant comment-actions

get-current
comment-actions set-current

\ only words in this wordlist are executed inside comments
\ at least the )) is needed.

\ switch back to the saved recognizer stack
: ))
  old-f-rs @ to forth-recognizer
; immediate

\ that's all for the comment actions
set-current

\ every word found is fine. Even the ones that are not found
\ in the dictionary
' noop dup dup dt:token: r:skip
: rec:skip ( addr len -- r:skip ) 2drop r:skip ;

\ search only in the comment-actions wordlist
: rec:comment-actions ( addr len -- xt +/-1 r:word | r:fail )
  comment-actions search-wordlist ( xt +/-1 | 0 )
  ?dup if dt:xt else dt:null then
;

\ a simple two-element recognizer stack
2 rec-stack constant rs:comment
' rec:skip ' rec:comment-actions 2 rs:comment set-recognizers

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to