Setting up a whole lot of testing infrastructure
[clnl] / src / main / main.lisp
index d9780baf8b759fa9346ca8c04f1f3b3aaeeb493f..b9f46707a1a5671c236f9a3ba4821c2bdd1411db 100644 (file)
@@ -3,17 +3,20 @@
 (defun e (ast) ast)
 
 (defun r (str)
- (let
-  ((ast (cl-nl.lexer:lex str)))
-  (format t "AST for ~S became ~S~%" str ast)
-  ast))
+ (let*
+  ((lexed-ast (let ((ast (cl-nl.lexer:lex str))) (format t "Via lexing, AST for ~S became ~S~%" str ast) ast))
+   (parsed-ast (let ((ast (cl-nl.parser:parse lexed-ast))) (format t "Via parsing, AST for ~S became ~S~%" lexed-ast ast) ast))
+   (transpiled-ast (let ((ast (cl-nl.transpiler:transpile-command-block parsed-ast))) (format t "Via transpiling, AST for ~S became ~S~%" parsed-ast ast) ast)))
+  (eval transpiled-ast)))
 
 (defun p (result) result)
 
 (defun run ()
- (loop for str = (read-line)
+ (loop for str = (progn (format t "> ") (force-output) (read-line))
        while str
-       do (p (e (r str))))
+       do (p (e (r str)))))
 
- ;(format t "AH HA~%")
- )
+(defun boot ())
+
+(defun run-commands (cmds)
+ (eval (cl-nl.transpiler:transpile-command-block (cl-nl.parser:parse  (cl-nl.lexer:lex cmds)))))