22** Newbie guide
33 - Load slime from the root directory.
44 - C-c C-l jscl.lisp to load the whole project
5- - =(jscl:bootstrap)= will generate jscl.js
5+ - =(jscl-xc :bootstrap "out/" "jscl" )= will generate out/ jscl.js
66 - Add tests
77 - Open tests.html in your browser to see your failed tests
88** Code organization, style, etc.
1616** Hacking the compiler
1717*** Interactive development
1818 - Load slime and bootstrap JSCL as explained in the newbie guide.
19- - Work in package JSCL with =(in-package #:jscl)=.
19+ - Work in package JSCL-XC with =(in-package #:jscl-xc )=.
2020 - Use the =compile-toplevel= function to prepare the JavaSript code
2121 associated to a S-expression SEXP, compiled as a toplevel form.
2222 - Use the =process-toplevel= function to prepare the JavaScript
2525
2626
2727#+BEGIN_EXAMPLE
28- JSCL> (process-toplevel '(+ 1 2))
28+ JSCL-XC > (process-toplevel '(+ 1 2))
2929(PROGN (SELFCALL (PROGN) (RETURN (+ 1 2))))
3030
31- JSCL> (compile-toplevel '(+ 1 2))
31+ JSCL-XC > (compile-toplevel '(+ 1 2))
3232"(function(){return 1+2;
3333})();
3434"
@@ -49,7 +49,7 @@ the =*js-output*= output channel, which can be set to =t= to target
4949stdout. For instance
5050
5151#+BEGIN_EXAMPLE
52- JSCL> (js '(+ 1 2))
52+ JSCL-XC > (js '(+ 1 2))
53531+2;
5454#+END_EXAMPLE
5555
@@ -58,21 +58,21 @@ calls and =named-function= to distinguish function expressions
5858featuring a function name.
5959
6060#+BEGIN_EXAMPLE
61- JSCL> (js '(call (property |console| "log") "A message."))
61+ JSCL-XC > (js '(call (property |console| "log") "A message."))
6262console['log']('A message.');
6363
64- JSCL> (js '(call (get |console| |log|) "A message."))
64+ JSCL-XC > (js '(call (get |console| |log|) "A message."))
6565console.log('A message.');
6666
67- JSCL> (js '(call (get |console| "log") "A message."))
67+ JSCL-XC > (js '(call (get |console| "log") "A message."))
6868console.log('A message.');
6969
7070
71- JSCL> (js '(function (a b) (return (+ a b))))
71+ JSCL-XC > (js '(function (a b) (return (+ a b))))
7272(function(A,B){return A+B;
7373});
7474
75- JSCL> (js '(named-function "add2" (a b) (return (+ a b))))
75+ JSCL-XC > (js '(named-function "add2" (a b) (return (+ a b))))
7676(function add2(A,B){return A+B;
7777});
7878#+END_EXAMPLE
@@ -102,13 +102,13 @@ generate. Compiler macros should not be mistaken for host Common Lisp
102102macros.
103103
104104#+BEGIN_EXAMPLE
105- JSCL> (define-builtin mod (x y)
105+ JSCL-XC > (define-builtin mod (x y)
106106 `(selfcall
107107 (if (== ,y 0)
108108 (throw "Division by zero in mod"))
109109 (return (% ,x ,y))))
110110
111- JSCL> (with-compilation-environment (process-toplevel '(mod 7 2)))
111+ JSCL-XC > (with-compilation-environment (process-toplevel '(mod 7 2)))
112112(PROGN
113113 (SELFCALL
114114 (IF (== 2 0)
0 commit comments