[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why Can't I compile this macro?
Consider the following macro -
(defmacro composite-bitstring (arg-pairs)
(if (cdr arg-pairs)
`(+!! (ash!! ,(composite-bitstring (cdr arg-pairs))
(!! ,(length-for-bitstring (first arg-pairs))))
,(encode-for-bitstring (first arg-pairs)))
(encode-for-bitstring (first arg-pairs))))
(defmacro encode-for-bitstring ((name length-or-type))
(if (eq length-or-type 'b)
`(if!! ,name (!! 1) (!! 0))
`,name))
(defmacro length-for-bitstring ((name length-or-type))
(if (eq length-or-type 'b)
`1
`,length-or-type))
When I try to compile composite-bitstring I get a stack overflow since
it seems that the compiler is trying to recursively evaluate the macro
as it compilers the macro.
I have no idea what is going on here. I have tried to write this without
using backquote notation and get similar behavior. HELP.
Thanks
Strip
drstrip@sandia.gov