Add CL style
[clnl] / src / main / main.lisp
index 9844d36923a1aed078244d6252e94a8e4eb769e7..8304d0f1432f2c85324dac1e02052fc4b8aad153 100644 (file)
@@ -1,28 +1,32 @@
-(in-package #:cl-nl)
+(in-package #:clnl)
 
 (defun e (ast) ast)
 
 (defun r (str)
  (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-commands parsed-ast))) (format t "Via transpiling, AST for~%~S~% became~%~S~%" parsed-ast ast) ast)))
+  ((lexed-ast (let ((ast (clnl-lexer:lex str)))
+               (format t "Via lexing, AST for~%~S~% became~%~S~%~%" str ast) ast))
+   (parsed-ast (let ((ast (clnl-parser:parse lexed-ast)))
+                (format t "Via parsing, AST for~%~S~% became~%~S~%~%" lexed-ast ast) ast))
+   (transpiled-ast (let ((ast (clnl-transpiler:transpile-commands 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 = (progn (format t "> ") (force-output) (read-line))
-       while str
-       do (p (e (r str)))))
+ (loop
+  :for str := (progn (format t "> ") (force-output) (read-line))
+  :while str
+  :do (p (e (r str))))
+ (sb-ext:exit))
 
 (defun boot ()
- (cl-nl.random:set-seed 15)
- (cl-nl.nvm:create-world)
- )
+ (clnl-random:set-seed 15)
+ (clnl-nvm:create-world))
 
 (defun run-commands (cmds)
- (eval (cl-nl.transpiler:transpile-commands (cl-nl.parser:parse  (cl-nl.lexer:lex cmds)))))
+ (eval (clnl-transpiler:transpile-commands (clnl-parser:parse (clnl-lexer:lex cmds)))))
 
 (defun run-reporter (reporter)
- (eval (cl-nl.transpiler:transpile-reporter (car (cl-nl.parser:parse (cl-nl.lexer:lex reporter))))))
+ (eval (clnl-transpiler:transpile-reporter (car (clnl-parser:parse (clnl-lexer:lex reporter))))))