\ website: http://home.hccnet.nl/anij/index.html \ ----- GATE ----- \ Albert Nijhof - dec 2003 forth definitions : } postpone exit postpone then ; immediate vocabulary fsa fsa also definitions here abs constant syntax \ security number : ?syntax ( x -- ) syntax <> abort" syntax error " ; : 0-gate cr .s true abort" Undefined gate " ; : gatea ( ccc -- body ) \ ccc must be a gate. ' >body dup cell+ @ ?syntax ; : ifornoif ( pos/neg -- ) 0< if postpone } syntax } postpone ; swap ! ; \ ----- The user words ----- forth definitions : gate ( ccc -- ) \ Declare gate ccc. create ['] 0-gate , syntax , does> begin @ execute ?dup 0= until ; \ The motor : == ( ccc -- gatea xt syntax ) \ Define the rules for ccc gatea :noname syntax ; : -if- ( syntax -- -syntax ) ?syntax postpone if syntax negate ; immediate : goto ( gatea xt -+syntax ccc -- ) dup abs ?syntax gatea postpone literal ifornoif ; immediate : ready ( gatea xt -+syntax -- ) dup abs ?syntax postpone false ifornoif ; immediate previous forth \ ----- end -----