Created
January 1, 2010 17:18
-
-
Save lsparrish/267165 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| : | char: | accept ; | |
| {{ | |
| | find $- ::: true if $ is a word. | | |
| | accept c"- ::: parsed text (delimited by c) goes at tib | | |
| | tib -$ ::: used to access text after parsing. | | |
| | nip xy-y ::: shorthand for swap drop | | |
| | dup n-nn ::: duplicate top of stack | | |
| | char: "-c ::: macro, gets a char at compile time. | | |
| | if f- ::: jump to then if flag is false (at execute time) | | |
| | then - ::: macro for the place that if jumps to when flag is false. | | |
| | not f-f ::: change false to true, true to false. | | |
| : defined ( "-f ) 32 accept tib find nip ; | |
| : evalTib ( - ) tib dup getLength eval ; | |
| : block{ ( "- ) char: } accept ; | |
| : block ( "- ) key char: { =if char: { emit block{ ; | |
| : evalBlock ( "- ) block evalTib ; | |
| : ifBlock ( f"- ) if evalBlock ;then block ; | |
| ---reveal--- | |
| : ifDefined ( "- ) defined ifBlock ; | |
| : ifNotDefined ( "- ) defined not ifBlock ; | |
| }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment