mirror of https://git.sr.ht/~solsen/rose
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
440 B
16 lines
440 B
module Rose.Data.Macro |
|
|
|
import Data.SExpression |
|
|
|
data Macro : Type where |
|
MkMacro : List SE -> SE -> Macro |
|
|
|
Interpreted Macro where |
|
interpret (Expression args body) = |
|
if (any (not . isSymbol) args) |
|
then MkError "Improper function." |
|
else MkMacro (toList args) body |
|
interpret _ = MkError "Improper function." |
|
|
|
expression (MkMacro args body) = |
|
(Expression (MkAtom (MkSymbol "macro")) (Expression (fromList args) body))
|
|
|