[parenscript-devel] ASDF compatibility for Parenscript

Red Daly reddaly at stanford.edu
Fri Jul 27 04:20:43 UTC 2007


Good evening,

You can now include Parenscript files in ASDF systems.  Parenscript will 
compile a whole slough of .paren files (with due respect for 
dependencies) into a single output stream.  This and the package system 
should allow people to share legitimately modularized Parenscripts.  In 
a short while, with some semantic analysis and optimization, it will be 
extremely easy and efficient to share Parenscript code.

See src/paren-asdf.lisp and src/compilation-interface.lisp for 
implementation details, and docs/internal/asdf.lisp & [1] for asdf 
reference.

Here is some syntax:

(defpackage paren-ajax-system
  (:use :cl :asdf))

(in-package :paren-ajax-system)

(defsystem :paren-ajax
  :name "paren-ajax"
  :author "Red Daly <reddaly at gmail.com.>"
  :version "0.0.1"
  :license "MIT"
  :description "Basic Parenscript functions for AJAX."
  :components ((:static-file "paren-ajax.asd")
               (:file "package")
               (:parenscript-file "util" :depends-on ("package"))
               (:parenscript-file "core-ajax" :depends-on ("package")))
  :depends-on (:parenscript))

The following will produce a string with all the Parenscript files in 
:paren-ajax and its dependencies compiled to javascript:

(with-output-to-string (stream)
  (parenscript:compile-script-system :paren-ajax :output-stream stream)))
=> "function util_lispyMap(util_fun, util_thing) 
{                                                                                                                                                                             

  return 
util_thing.map(util_fun);                                                                                                                                                                   

};                                                                                                                                                                                                   

var parenAjax_hellobang = 'hi there';
"

There are two ways to compile Parenscript systems via ASDF:
1.  Parenscript files will be compiled when the system is compiled (via 
asdf:compile-op), giving warnings and errors alongside lisp warnings and 
errors.  This will produce a bunch of .js files that ride in tandem with 
your .paren files
2.  Use the method described above.  This outputs Javascript code to a 
single stream.

2 works with whole ASDF systems, not individual components.  I would 
like to get it working for individual components, however.  Suggestions 
are welcome for how to do this.  See docs/internal/asdf.lisp for the 
entirety of ASDF source code.  This is what I used as a reference to 
implement the extension.

Enjoy,
Red

[1] http://constantly.at/lisp/asdf/index.html#Top





More information about the parenscript-devel mailing list