Improve parser - generate prims from procedures
[clnl] / src / main / code-parse.lisp
index 7cdf2b5b1864ff53ea9483a18464e2b906cc56c4..644ef13278f3ea145cdfdeb40ef959dc69c0f3bb 100644 (file)
@@ -32,9 +32,19 @@ DESCRIPTION:
   in the CLNL-CODE-PARSER package to tease out necessary information.  Some of
   those things will involve code blocks that can then be transpiled."
  (let
-  ((*dynamic-prims* (mapcar #'global->prim external-globals)))
+  ((*dynamic-prims*
+    (append
+     (mapcar #'global->prim external-globals)
+     (procedures->prims lexed-ast))))
   (parse-internal lexed-ast)))
 
+(defun procedures->prims (lexed-ast)
+ (cond
+  ((not lexed-ast) nil)
+  ; We'll need argument handling here sometime :)
+  ((eql :to (car lexed-ast)) (cons (list :name (cadr lexed-ast)) (procedures-to-prims (cdr lexed-ast))))
+  (t (procedures-to-prims (cdr lexed-ast)))))
+
 (defun parse-internal (lexed-ast)
  (cond
   ((not lexed-ast) nil)