![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

\ =====================================================================
\ PARSER compile/execute a word in a wordlist context.
\ =====================================================================
\ It is sometimes risky to open two packages because there is sometimes
\ a possibility to have synonyms.
\ Used in a wordlist context X, the word PARSER define a word which will
\ allow to compile/interpret definitions of this context X.
: PARSER ( "method" -- )
create context @ , immediate
does>
@ bl word count
rot search-wordlist dup
0= ABORT" no found in parser context."
0< state @ and IF compile, ELSE execute THEN ;
\ test
package pack-test
: i ( n -- ) . ;
: z ( z -- ) zcount type ;
: s ( a n -- ) type ;
public
parser dot>
end-package
\\ test
: test
3 0 DO
i dot> i
z" hello " dot> z
s" bye " dot> s
cr
LOOP ;
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Thu Jun 22 2006 - 11:56:41 PDT
This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 03:04:21 PST