+ running engine."
+
+ (let
+ ((*dynamic-prims*
+ (mapcar
+ (lambda (prim)
+ (if (getf prim :macro)
+ (append (list :func (getf prim :macro)) prim)
+ (append (list :func (lambda (&rest args) `(funcall ,(getf prim :func) ,@args))) prim)))
+ dynamic-prims)))
+ (cond
+ ((command-list-p parsed-ast) (transpile-commands parsed-ast))
+ ((and (listp parsed-ast) (= 1 (length parsed-ast)) (reporter-p (car parsed-ast)))
+ (transpile-reporter (car parsed-ast)))
+ (t (error "Is neither a list of commands nor a reporter: ~S" parsed-ast)))))
+
+(defun command-list-p (parsed-ast)
+ "COMMAND-LIST-P PARSED-AST => RESULT
+
+ARGUMENTS AND VALUES:
+
+ PARSED-AST: An ast as returned by the parser
+ RESULT: A boolean
+
+DESCRIPTION:
+
+ COMMAND-LIST-P returns whether the parsed-ast is a valid list
+ of commands."
+ (and
+ (every #'listp parsed-ast)
+ (every #'prim-command-p (mapcar #'find-prim (mapcar #'car parsed-ast)))))
+
+(defun reporter-p (parsed-ast)
+ "REPORTER-P PARSED-AST => RESULT
+
+ARGUMENTS AND VALUES:
+
+ PARSED-AST: An ast as returned by the parser
+ RESULT: A boolean
+
+DESCRIPTION:
+
+ REPORTER-P returns whether the parsed-ast is a valid reporter."
+ (and
+ (symbolp (car parsed-ast))
+ (prim-reporter-p (find-prim (car parsed-ast)))))
+
+; Let this grow, slowly but surely, eventually taking on calling context, etc.
+; For now, it's just a
+(defun transpile-commands (parsed-ast)