-(in-package :js)
+(in-package :ps)
;;;# Introduction
;;;
;;; ParenScript is a simple language that looks a lot like Lisp, but
;;; ParenScript "compiler" transforms the expression in ParenScript
;;; into an equivalent, human-readable expression in JavaScript.
-(js
+(ps
(defun foobar (a b)
(return (+ a b))))
;;; programmer of the burden of iterating over arrays.
;;; `for' loops can be written using the customary `DO' syntax.
-(js
+(ps
(do ((i 0 (incf i))
(j (aref arr i) (aref arr i)))
((>= i 10))
}
"
;;; ParenScript uses the Lisp reader, allowing for reader macros. It
-;;; also comes with its own macro environment, allowing host macros
-;;; and ParenScript to coexist without interfering with each other.
-;;; Furthermore, ParenScript uses its own compiler macro system,
-;;; allowing for an even further customization of the generation of
-;;; JavaScript. For example, the `1+' construct is implemented using a
-;;; ParenScript macro:
-
-(defjsmacro 1+ (form)
+;;; also comes with its own macro environment, allowing host Lisp
+;;; macros and ParenScript macros to coexist without interfering with
+;;; each other. For example, the `1+' construct is implemented using
+;;; a ParenScript macro:
+
+(defpsmacro 1+ (form)
`(+ ,form 1))
;;; ParenScript allows the creation of JavaScript objects in a Lispy
;;; way, using keyword arguments.
-(js
+(ps
(create :foo "foo"
:bla "bla"))
bla : 'bla' }
"
;;; ParenScript features a HTML generator. Using the same syntax as
-;;; the `HTMLGEN' package of Franz, Inc., it can generate JavaScript
+;;; the HTMLGEN package of Franz, Inc., it can generate JavaScript
;;; string expressions. This allows for a clean integration of HTML in
;;; ParenScript code, instead of writing the tedious and error-prone
;;; string generation code generally found in JavaScript.
-(js
+(ps
(defun add-div (name href link-text)
(document.write
- (html ((:div :id name)
- "The link is: "
- ((:a :href href) link-text))))))
+ (ps-html ((:div :id name)
+ "The link is: "
+ ((:a :href href) link-text))))))
; compiles to
"
"
;;; In order to have a complete web application framework available in
;;; Lisp, ParenScript also provides a sexp-based syntax for CSS
-;;; files. Thus, a complete web application featuring HTML, CSS and
-;;; JavaScript documents can be generated using Lisp syntax, allowing
-;;; the programmer to use Lisp macros to factor out the redundancies
-;;; and complexities of Web syntax. For example, to generate a CSS
-;;; inline node in a HTML document:
+;;; stylesheets. Thus, a complete web application featuring HTML, CSS
+;;; and JavaScript documents can be generated using Lisp syntax,
+;;; allowing the programmer to use Lisp macros to factor out the
+;;; redundancies and complexities of Web syntax. For example, to
+;;; generate a CSS inline node in a HTML document using the
+;;; AllegroServe HTMLGEN library:
(html-stream *standard-output*
(html
</style>
</head>
</html>
-
-;;;# Getting ParenScript
-;;;
-;;; ParenScript can be obtained from the BKNR subversion repository at
-
- svn://bknr.net/trunk/bknr/src/js
-
-;;; ParenScript does not depend on any part of BKNR though. You can
-;;; download snapshots of ParenScript at the webpage
-
- http://bknr.net/parenscript
-
-;;; or using asdf-install.
-
- (asdf-install:install 'parenscript)
-
-;;;
-;;; After downloading the ParenScript sourcecode, set up the ASDF
-;;; central registry by adding a symlink to "parenscript.asd". Then
-;;; use ASDF to load ParenScript. You may want to edit the ASDF file
-;;; to remove the dependency on the Allegroserve HTMLGEN facility.
-
- (asdf:oos 'asdf:load-op :parenscript)
-
-;;; ParenScript was written by Manuel Odendahl. He can be reached at
-
- manuel@bknr.net
-