1 ! Copyright (C) 2007, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: parser kernel sequences words effects combinators assocs
4 definitions quotations namespaces memoize accessors ;
7 : real-macro-effect ( word -- effect' )
8 "declared-effect" word-prop in>> 1 <effect> ;
10 : define-macro ( word definition -- )
11 [ "macro" set-word-prop ]
12 [ over real-macro-effect memoize-quot [ call ] append define ]
15 : MACRO: (:) define-macro ; parsing
17 PREDICATE: macro < word "macro" word-prop >boolean ;
19 M: macro definer drop \ MACRO: \ ; ;
21 M: macro definition "macro" word-prop ;
24 [ call-next-method ] [ f "macro" set-word-prop ] bi ;