b9f46707a1a5671c236f9a3ba4821c2bdd1411db
[clnl] / src / main / main.lisp
1 (in-package #:cl-nl)
2
3 (defun e (ast) ast)
4
5 (defun r (str)
6  (let*
7   ((lexed-ast (let ((ast (cl-nl.lexer:lex str))) (format t "Via lexing, AST for ~S became ~S~%" str ast) ast))
8    (parsed-ast (let ((ast (cl-nl.parser:parse lexed-ast))) (format t "Via parsing, AST for ~S became ~S~%" lexed-ast ast) ast))
9    (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)))
10   (eval transpiled-ast)))
11
12 (defun p (result) result)
13
14 (defun run ()
15  (loop for str = (progn (format t "> ") (force-output) (read-line))
16        while str
17        do (p (e (r str)))))
18
19 (defun boot ())
20
21 (defun run-commands (cmds)
22  (eval (cl-nl.transpiler:transpile-command-block (cl-nl.parser:parse  (cl-nl.lexer:lex cmds)))))