1 ! Copyright (C) 2007, 2010 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 fry
10 : real-macro-effect ( effect -- effect' )
11 in>> { "quot" } <effect> ;
15 : define-macro ( word definition effect -- )
18 [ '[ _ _ call-effect ] ] keep
19 [ memoize-quot '[ @ call ] ] keep
22 [ drop "macro" set-word-prop ]
23 [ 2drop changed-effect ]
26 SYNTAX: MACRO: (:) define-macro ;
28 PREDICATE: macro < word "macro" word-prop >boolean ;
30 M: macro make-inline cannot-be-inline ;
32 M: macro definer drop \ MACRO: \ ; ;
34 M: macro definition "macro" word-prop ;
37 [ call-next-method ] [ f "macro" set-word-prop ] bi ;
39 M: macro always-bump-effect-counter? drop t ;