Clinton Ebadi [Tue, 8 Dec 2009 18:37:55 +0000 (13:37 -0500)]
s/js:funcall/js::funcall/
Clinton Ebadi [Thu, 8 Oct 2009 19:31:57 +0000 (15:31 -0400)]
Remove `labels' in favor of `letrec'
This is more general and is a better name given that Javascript does
not have separate value/function namespaces
Clinton Ebadi [Thu, 8 Oct 2009 19:23:15 +0000 (15:23 -0400)]
Lisp-2 removal (part one)
* Remove `flet', `function', and `funcall' special forms/macros
* `js::funcall' is kept because it makes the AST a bit easier to work
with, but this is for internal use only
Clinton Ebadi [Thu, 8 Oct 2009 19:11:17 +0000 (15:11 -0400)]
Lexical renaming rework (part one and a half)
* Properly expand `let' inside of an expression
* Do not introduce new `js:block' when compiling statements
Clinton Ebadi [Thu, 8 Oct 2009 18:11:16 +0000 (14:11 -0400)]
Move lexical binding renaming to JS:VARIABLE printer (part one)
This moves lexical binding renaming into the printer for
`js:variable' (where it belongs -- using symbol-macros for this makes
the compiler a lot messier than it need be). Right now a new block is
unnecessarily introduced for every `let' expression.
* Rewrite `let' special form
* Enclose variable name in `js:variable' when expanding `var' special
form
* Maintain lexical binding stack in printer for `js:let'
* Perform renaming for all `js:variable' forms at print time
Clinton Ebadi [Tue, 6 Oct 2009 22:00:51 +0000 (18:00 -0400)]
remove debugging cruft
Clinton Ebadi [Tue, 6 Oct 2009 18:52:41 +0000 (14:52 -0400)]
Expand compound symbol (warning: very lightly tested)
Performs expansion and renaming of compound symbols in
`ps-compile-symbol' and for function names in `(funcall NAME . args)'
forms. This will probably break with other special forms and needs
more testing / possible reimplementation at another level of the
compiler.
Clinton Ebadi [Tue, 6 Oct 2009 18:49:58 +0000 (14:49 -0400)]
Initial compund symbol (foo.bar syntax) splitting function
Clinton Ebadi [Tue, 6 Oct 2009 16:39:11 +0000 (12:39 -0400)]
Merge branch 'master' into symbol-syntax
Daniel Gackle [Tue, 22 Sep 2009 05:29:31 +0000 (23:29 -0600)]
Fixed bug: dotted lists weren't being destructured properly.
Daniel Gackle [Tue, 22 Sep 2009 00:20:50 +0000 (18:20 -0600)]
Fixed a bug in PS LOOP: the :INITIALLY and :FINALLY clauses should execute whether or not the loop body is executed.
Clinton Ebadi [Thu, 17 Sep 2009 23:59:06 +0000 (19:59 -0400)]
Reimplement (.method object . args) syntax
Using PS:FUNCALL, PS:CHAIN, or ((PS:SLOT-VALUE ...) ...) for method
invocation is rather unwieldy for something so common in
javascript. This reenables the convenient (.method ...) call syntax in
a way that seems reasonably clean.
This may have subtle issues with the lexical-let variable renamer and
such, but my cursory skimming of the new compiler source doesn't seem
to indicate any serious issues.
Daniel Gackle [Thu, 17 Sep 2009 23:47:52 +0000 (17:47 -0600)]
Added &OPTIONAL to DESTRUCTURING-BIND. Currently it's just ignored (next step woudl be to support default values).
Daniel Gackle [Tue, 15 Sep 2009 17:54:59 +0000 (11:54 -0600)]
DESTRUCTURING-BIND now supports &REST.
Vladimir Sedach [Thu, 17 Sep 2009 18:18:51 +0000 (12:18 -0600)]
Fixed symbol macro bug (thanks to Daniel Gackle for the bug report).
Vladimir Sedach [Mon, 14 Sep 2009 18:12:00 +0000 (12:12 -0600)]
Replaced redundant string functions in utils.lisp with
standard/library ones.
Vladimir Sedach [Sun, 13 Sep 2009 22:19:11 +0000 (16:19 -0600)]
Fixed the CHAIN macro to correctly chain plain slot values.
Thanks to Daniel White <daniel@whitehouse.id.au> for the patch.
Vladimir Sedach [Sun, 13 Sep 2009 22:04:53 +0000 (16:04 -0600)]
Changed op-precedence back to a memoized table (performance tweaks).
Vladimir Sedach [Sun, 13 Sep 2009 21:49:27 +0000 (15:49 -0600)]
Memoized SYMBOL-NAME-TO-JS-STRING (performance improvement).
Vladimir Sedach [Fri, 11 Sep 2009 19:21:57 +0000 (13:21 -0600)]
Added symbolp check before the use of lookup-macro-def in
ps-macroexpand (more low-hanging performance fruit).
Vladimir Sedach [Fri, 11 Sep 2009 19:13:35 +0000 (13:13 -0600)]
Refactored SYMBOL-NAME-TO-JS-STRING.
Vladimir Sedach [Fri, 11 Sep 2009 18:56:40 +0000 (12:56 -0600)]
Changed printing subsystem interface to allow direct output to
streams. Added 'ps-to-stream' function.
Vladimir Sedach [Fri, 11 Sep 2009 16:58:11 +0000 (10:58 -0600)]
Refactored compile-parenscript-form code.
Vladimir Sedach [Fri, 11 Sep 2009 09:37:03 +0000 (03:37 -0600)]
Refactored ps-compiler method name for symbols.
Daniel Gackle [Wed, 19 Aug 2009 20:34:38 +0000 (13:34 -0700)]
Factored out duplication between simple and parallel loops.
Daniel Gackle [Tue, 18 Aug 2009 23:58:31 +0000 (16:58 -0700)]
Correcting how parallel loop handles destructuring lists.
Daniel Gackle [Tue, 18 Aug 2009 23:22:10 +0000 (16:22 -0700)]
Separated the processing of single and parallel loops.
Daniel Gackle [Tue, 18 Aug 2009 21:54:41 +0000 (14:54 -0700)]
Fixed problem with destructuring-lists in multiple-for clauses (they need binding before the first execution of the loop). This solution is not optimal, because it creates new bindings for the variable inside the loop, and emits the pre-loop bindings even when they aren't being used.
Daniel Gackle [Sun, 16 Aug 2009 00:24:14 +0000 (17:24 -0700)]
Removed trailing whitespace.
Daniel Gackle [Sun, 16 Aug 2009 00:22:36 +0000 (17:22 -0700)]
Eliminated unused local variables that caused compiler warnings in CCL.
Daniel Gackle [Fri, 14 Aug 2009 08:13:09 +0000 (01:13 -0700)]
Made PS LOOP conform to LOOP's semantics regarding parallel FOR clauses. A clause's end-test should take place before the next clause's step form.
Daniel Gackle [Thu, 13 Aug 2009 20:04:19 +0000 (13:04 -0700)]
Broke up loop parsing by pushing local functions to top level and passing a state object around.
Vladimir Sedach [Wed, 12 Aug 2009 21:01:51 +0000 (15:01 -0600)]
Fixed a bug where 'create' was special-casing keywords in
inappropriate ways.
(slot-value (create :foo-bar 1) :foo-bar) was being translated as
({ fooBar : 1 })['foo-bar']
Vladimir Sedach [Fri, 7 Aug 2009 04:22:20 +0000 (22:22 -0600)]
Merge branch 'master' of ssh://vsedach@common-lisp.net/project/parenscript/public_html/git/parenscript
Vladimir Sedach [Fri, 7 Aug 2009 04:21:11 +0000 (22:21 -0600)]
Fixed nary comparison operators (ex: (< 1 2 3) should translate to (1
< 2) && (2 < 3) instead of 1 < 2 < 3).
Daniel Gackle [Wed, 5 Aug 2009 23:51:32 +0000 (17:51 -0600)]
Made the COUNT clause in PS LOOP evaluate its term before counting (and skip nil)
like CL does.
Daniel Gackle [Fri, 31 Jul 2009 20:20:15 +0000 (14:20 -0600)]
Added :REPEAT clauses to PS's LOOP.
Vladimir Sedach [Sat, 1 Aug 2009 19:15:23 +0000 (13:15 -0600)]
Exported 'chain' helper macro.
Vladimir Sedach [Mon, 27 Jul 2009 20:10:51 +0000 (14:10 -0600)]
Changed 'slot-value' to print keyword slot names as strings.
Red Daly [Sun, 26 Jul 2009 20:22:54 +0000 (20:22 +0000)]
Fixed eval-when special form and added tests to prevent future breakage.
Vladimir Sedach [Sat, 25 Jul 2009 22:01:37 +0000 (16:01 -0600)]
Changed 'create' and 'slot-value' to treat reserved JS keywords as
strings.
Thanks to Alexey Lebedeff for the idea.
http://common-lisp.net/pipermail/parenscript-devel/2009-July/000558.html
Vladimir Sedach [Sat, 25 Jul 2009 21:43:00 +0000 (15:43 -0600)]
Revised PS literal mechanism to use 'symbol-name-to-js-string' instead
of 'symbol-name' to check symbol names for conflicts with reserved JS
keywords. Added list of currently reserved JS keyword names.
Daniel Gackle [Sat, 11 Jul 2009 01:17:39 +0000 (19:17 -0600)]
PS LOOP now supports ON.
Daniel Gackle [Fri, 10 Jul 2009 22:31:55 +0000 (16:31 -0600)]
DESTRUCTURING-BIND can now handle dotted and nested binding lists.
Daniel Gackle [Wed, 1 Jul 2009 01:52:12 +0000 (19:52 -0600)]
Added support for COUNT, MINIMIZE and MAXIMIZE to PS-LOOP.
Daniel Gackle [Wed, 1 Jul 2009 01:29:44 +0000 (19:29 -0600)]
Extended PS-LOOP to allow explicit accumulation variables (declared by INTO as in "sum x into y").
Vladimir Sedach [Mon, 6 Jul 2009 20:13:15 +0000 (14:13 -0600)]
Rewrote 'ps' macro to expand into 'with-output-to-string' instead of
'concatenate,' which gives better runtime performance.
Vladimir Sedach [Thu, 18 Jun 2009 23:11:56 +0000 (17:11 -0600)]
Added the 'chain' convenience macro for method call chaining (ex:
(chain ($ "foo") (bar x z) (baz 5)) => $('foo').bar(x, z).baz(5);)
Vladimir Sedach [Mon, 8 Jun 2009 05:30:52 +0000 (23:30 -0600)]
Changed destructuring-bind to use let* instead of let in its
macroexpansion.
Bug report due to Scott
Bell. http://common-lisp.net/pipermail/parenscript-devel/2009-June/000532.html
Vladimir Sedach [Mon, 8 Jun 2009 05:27:47 +0000 (23:27 -0600)]
Fixed several special forms that were not macroexpanding their
arguments.
Bug reports thanks to Scott
Bell. http://common-lisp.net/pipermail/parenscript-devel/2009-June/000530.html
Vladimir Sedach [Mon, 8 Jun 2009 04:52:58 +0000 (22:52 -0600)]
Introduced 'function' special form to further help with faking Lisp2
in JavaScript.
Previously, 'apply,' among others, did not recognize the second
namespace as introduced by flet/labels. Thanks to Scott Bell for the
bug report:
http://common-lisp.net/pipermail/parenscript-devel/2009-June/000529.html
Vladimir Sedach [Mon, 8 Jun 2009 04:35:05 +0000 (22:35 -0600)]
Fixed 'flatten' to correctly handle lists with non-nil cdr (ie '(1 . 2)).
Thanks to Scott Bell for the bug report.
http://common-lisp.net/pipermail/parenscript-devel/2009-June/000528.html
Vladimir Sedach [Mon, 25 May 2009 00:53:03 +0000 (18:53 -0600)]
Changed process-html-forms-lhtml loop in lib/ps-html.lisp from 'loop'
to 'do' due to bug in CLISP's 'loop' implementation (this also made
the code shorter).
Thanks to Olaf Ruppert <oruppert@googlemail.com> for the bug report.
Vladimir Sedach [Fri, 15 May 2009 22:04:33 +0000 (16:04 -0600)]
Fixed some special forms that weren't macro-expanding their arguments.
Vladimir Sedach [Fri, 15 May 2009 00:38:10 +0000 (18:38 -0600)]
let/let* no longer gensym variable names when they are not bound in
enclosing lexical scopes, resulting in prettier output ("var x = 1",
instead of "var x1 = 1") in typical usage of let.
Vladimir Sedach [Sun, 10 May 2009 17:39:02 +0000 (11:39 -0600)]
Made compiled-form-to-string use write-string instead of printc, which
results in a much more efficient ps*.
Daniel Gackle [Fri, 8 May 2009 21:13:18 +0000 (15:13 -0600)]
Added support for supplied-p parameters to optional and keyword arguments.
Daniel Gackle [Fri, 8 May 2009 20:59:05 +0000 (14:59 -0600)]
Extended DESTRUCTURING-BIND to allow NIL bindings to indicate a place should be ignored, the way that CL LOOP does.
Vladimir Sedach [Sat, 9 May 2009 23:24:22 +0000 (17:24 -0600)]
Substantially modified the way Parenscript compilation and
macro-expansion take place. This gives control of macroexpansion to
special forms, and lets Parenscript do things like fake being a Lisp2
(different function and variable namespaces), and overall makes
Parenscript compilation look a lot more like CL compilation.
Vladimir Sedach [Sat, 9 May 2009 04:54:07 +0000 (22:54 -0600)]
Fixed bug where macrolet and symbol-macrolet special forms were always
compiling their implicit progn bodies to statements.
Vladimir Sedach [Sun, 3 May 2009 21:31:16 +0000 (15:31 -0600)]
Reimplemented flet and labels to use the same renaming tricks as the
let/let* patch to correctly implement lexical scoping.
Vladimir Sedach [Sun, 3 May 2009 20:42:12 +0000 (14:42 -0600)]
Implemented LET and LET* by variable renaming, which provides the
correct scoping semantics, and simplifies both the producing and the
produced code.
Removed the "." and "[]" name-mangling conventions from
symbol-to-js-string. Any code that uses symbols such as "foo.bar[baz]"
will now issue a warning, and needs to be rewritten to use standard
Lisp accessors. This is needed for variable renaming to work, and is
an extension of the patch that eliminated the ".method" method-calling
convention.
Thanks to Daniel Gackle and Dough Hoyte for opening my eyes to this
technique, which was right in front of me all along.
Vladimir Sedach [Sun, 3 May 2009 17:01:20 +0000 (11:01 -0600)]
Removed unused function val-to-string from utils.lisp
Vladimir Sedach [Wed, 29 Apr 2009 06:20:48 +0000 (00:20 -0600)]
Added file compilation and eval-when facilities (patch from Red Daly).
Vladimir Sedach [Wed, 29 Apr 2009 02:17:34 +0000 (20:17 -0600)]
Fixed bug with incorrectly parenthesized if expressions.
Thanks to Daniel Gackle for the bug report.
Vladimir Sedach [Wed, 29 Apr 2009 01:22:36 +0000 (19:22 -0600)]
Fixed non-uniform handling of quoted symbols that manifested itself in
broken package obfuscation.
Thanks to Red Daly for the bug report.
Vladimir Sedach [Mon, 27 Apr 2009 21:52:55 +0000 (15:52 -0600)]
Fixed bug in keyword argument handling (patch thanks to Red Daly).
Kelly McDonald [Wed, 22 Apr 2009 18:38:14 +0000 (14:38 -0400)]
method trick was yanked in
79630c82ac03066ceb1dac50015eb6b7a2151bbe but the documentation makes it look as if you can still do this.
A further note with something about a backwards incompatible change
might also be useful
Vladimir Sedach [Mon, 20 Apr 2009 03:24:23 +0000 (21:24 -0600)]
Fixed typo in ps-macro-lib.lisp
Vladimir Sedach [Tue, 14 Apr 2009 01:43:15 +0000 (19:43 -0600)]
Added the colon character (:) to the list of special characters that have special translations in symbol-to-js-string.
Vladimir Sedach [Mon, 13 Apr 2009 21:31:07 +0000 (15:31 -0600)]
Introduced the *js-target-version* special variable, which is designed
to control which version of JavaScript Parenscript is emitting code
for. This can be used to emit shorter code for certain constructs
(this patch uses this facility to generate shorter keyword-handling
code for JS version 1.6 and later).
Vladimir Sedach [Mon, 13 Apr 2009 20:05:10 +0000 (14:05 -0600)]
Got rid of 'ensure-ps-symbol' internal function (at this point all it was doing was polluting the PS package).
Daniel Gackle [Sun, 12 Apr 2009 19:49:41 +0000 (12:49 -0700)]
Added destructuring lists to PS-LOOP.
Vladimir Sedach [Mon, 13 Apr 2009 04:35:15 +0000 (22:35 -0600)]
Removed some unnecessary code that ignored an anaphor in define-ps-special-form (declare (ignorable sufficed.
Vladimir Sedach [Mon, 13 Apr 2009 04:33:29 +0000 (22:33 -0600)]
Changed representation of expression blocks and 'if' to look more like JS in intermediate code.
Vladimir Sedach [Sun, 12 Apr 2009 23:17:31 +0000 (17:17 -0600)]
Merge branch 'master' of ssh://vsedach@common-lisp.net/project/parenscript/public_html/git/parenscript
Vladimir Sedach [Sun, 12 Apr 2009 23:16:12 +0000 (17:16 -0600)]
Removed 'append' from runtime lib since Daniel Gackle provided a more concise macro version in
83a26b36c.
Daniel Gackle [Sun, 12 Apr 2009 06:51:27 +0000 (23:51 -0700)]
Added a file PS-DOM with handy utility macros for DOM functionality, e.g. Lispy ways of accessing offsetWidth, offsetHeight, etc.
Daniel Gackle [Sun, 12 Apr 2009 06:15:41 +0000 (23:15 -0700)]
Added several new utility macros, including a primitive DESTRUCTURING-BIND.
Daniel Gackle [Sun, 12 Apr 2009 05:12:51 +0000 (22:12 -0700)]
Modified the way the PS-LOOP does SUM (it now gensyms an accumulation var rather than accepting INTO) and added COLLECT to work the same way.
Daniel Gackle [Sun, 12 Apr 2009 05:11:55 +0000 (22:11 -0700)]
Added a macro WITH-LAMBDA that's useful for wrapping one or more statements up into an expression.
Vladimir Sedach [Sun, 12 Apr 2009 02:25:18 +0000 (20:25 -0600)]
Updated tests to reflect changes in latest patches from Daniel Gackle.
Vladimir Sedach [Sun, 12 Apr 2009 01:57:19 +0000 (19:57 -0600)]
Fixed 'lisp' form to produce code that captures enclosing lexical scope correctly in 'ps' macro (broke it in my previous patch
0ce67a33), added unit tests to check for expansion in correct environment.
Vladimir Sedach [Sun, 12 Apr 2009 01:56:46 +0000 (19:56 -0600)]
Exported 'loop' from Parenscript package, moved utility functions to src/utils.lisp.
Vladimir Sedach [Sun, 12 Apr 2009 02:25:18 +0000 (20:25 -0600)]
Updated tests to reflect changes in latest patches from Daniel Gackle.
Vladimir Sedach [Sun, 12 Apr 2009 01:57:19 +0000 (19:57 -0600)]
Fixed 'lisp' form to produce code that captures enclosing lexical scope correctly in 'ps' macro (broke it in my previous patch
0ce67a33), added unit tests to check for expansion in correct environment.
Vladimir Sedach [Sun, 12 Apr 2009 01:56:46 +0000 (19:56 -0600)]
Exported 'loop' from Parenscript package, moved utility functions to src/utils.lisp.
Daniel Gackle [Sat, 11 Apr 2009 22:55:05 +0000 (15:55 -0700)]
Restored the old psmacro for LISP evaluation, because the new special form wasn't working.
Daniel Gackle [Sat, 11 Apr 2009 22:51:29 +0000 (15:51 -0700)]
When turning a quoted list into a JS array, compile elements that are NIL as "null", not "[]". There is no way to make JS completely consistent with Lisp here, because NIL means two different things in JS (null or an empty list) where it means only one thing in Lisp. We have to pick one thing in this context, and "[null]" is more common than "[[]]".
Daniel Gackle [Sat, 11 Apr 2009 22:48:02 +0000 (15:48 -0700)]
Quoted symbols should be emitted as literal strings, not converted first to JS symbols, otherwise symbols with characters like * and ? will be emitted as "star" and "what", which makes sense only if you're trying to define a function or variable name, but not if you're generating arbitrary strings.
Daniel Gackle [Sat, 11 Apr 2009 22:47:17 +0000 (15:47 -0700)]
Generate "[]" rather than "new Array()" for concision.
Daniel Gackle [Sat, 11 Apr 2009 22:40:30 +0000 (15:40 -0700)]
Changed PS-LOOP to emit DO* (i.e. normal JS for-loop code) rather than DO. It was originally written when DO meant DO* (in today's terms). Using DO here makes the generated code slower and breaks a bunch of our existing cases. Also, DO* produces more idiomatic JS code and should be the default case (there is unfortunately no single default here that gives all the desired behavior, but this is a better tradeoff).
Daniel Gackle [Sat, 11 Apr 2009 22:39:31 +0000 (15:39 -0700)]
Use WITH-OUTPUT-TO-STRING instead of CONCATENATE, because the latter fails when there are too many arguments (this happens in Clozure more often than SBCL).
Vladimir Sedach [Tue, 7 Apr 2009 02:46:19 +0000 (20:46 -0600)]
Modified the PS compiler to produce an intermediate representation that looks like raw JavaScript in s-exp notation.
Removed the doeach macro.
Vladimir Sedach [Mon, 6 Apr 2009 00:16:17 +0000 (18:16 -0600)]
Changed tests to reflect Daniel Gackle's keyword arguments patch.
Daniel Gackle [Thu, 2 Apr 2009 22:05:28 +0000 (15:05 -0700)]
Initialize keyword arguments from js ARGUMENTS, allowing keywords to also be passed as normal function arguments without an error being thrown.
Daniel Gackle [Thu, 2 Apr 2009 04:01:03 +0000 (21:01 -0700)]
Added a partial implementation of LOOP to PS.
Vladimir Sedach [Sun, 5 Apr 2009 23:50:15 +0000 (17:50 -0600)]
Made the ignore declaration in define-ps-special-form be generated on the condition that 'expecting is used in the body. While it's not an error to use variables previously declared ignored, it does raise annoying compiler warnings in some Lisps.
Vladimir Sedach [Sat, 4 Apr 2009 22:39:15 +0000 (16:39 -0600)]
Removed compile-time constant string concatenation from the Parenscript printer, which was significantly slowing down compilation.
Vladimir Sedach [Tue, 31 Mar 2009 19:36:32 +0000 (13:36 -0600)]
Changed the definition of define-ps-special-form to make "expecting" an anaphor.