From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: ECMAScript support broken? Date: Mon, 3 Jan 2011 02:25:26 -0500 Message-ID: References: <87ei8vxngp.fsf@anar.kanru.info> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=0015176f16f648f7c40498ec0e57 X-Trace: dough.gmane.org 1294039544 16695 80.91.229.12 (3 Jan 2011 07:25:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 3 Jan 2011 07:25:44 +0000 (UTC) Cc: guile-devel@gnu.org To: Kan-Ru Chen Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Jan 03 08:25:40 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PZenT-000136-T9 for guile-devel@m.gmane.org; Mon, 03 Jan 2011 08:25:40 +0100 Original-Received: from localhost ([127.0.0.1]:57112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZenS-0006vV-LW for guile-devel@m.gmane.org; Mon, 03 Jan 2011 02:25:38 -0500 Original-Received: from [140.186.70.92] (port=36705 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZenI-0006vM-DM for guile-devel@gnu.org; Mon, 03 Jan 2011 02:25:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZenH-0007DY-9g for guile-devel@gnu.org; Mon, 03 Jan 2011 02:25:28 -0500 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:41585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZenG-0007DS-Vw for guile-devel@gnu.org; Mon, 03 Jan 2011 02:25:27 -0500 Original-Received: by wwb17 with SMTP id 17so13560892wwb.30 for ; Sun, 02 Jan 2011 23:25:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=DZ5x67L/iINX51V992LVZnOsQJLxIoBosBw4RJdREBk=; b=Vbm9YDN1CxIfPT2S/SNo4Mu/Vcv1TkFVXYhXZAmkF5kLhpOAFLwhMpWhdNyF6e4MLR S6afRi2EEWgBykyJCe/qS7Wz27fJ8eEsJJSuFdzFfL2GV9a/U1ytMi4dpU4H+qwEN8I+ XiU2IpQQL2GxQO05q8iJIp5qQFa6efkDxVc00= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=ax2c3Z3L44wyAGy9prgCI9kHWsCP//izwEG7C7xFg7dYtMgAAhkD7WGsPDjZGKgZOv NXFUJvuvZXgI92Pu8BP4zowS5ynanridJS2SWydEfHJ6Q03bJLoGOgSSCPAx6pWM78ub 0GHwHMBKruReOoXjMPAQJIlI13GRzG9oTGFf0= Original-Received: by 10.216.16.21 with SMTP id g21mr5940369weg.6.1294039526209; Sun, 02 Jan 2011 23:25:26 -0800 (PST) Original-Received: by 10.216.156.65 with HTTP; Sun, 2 Jan 2011 23:25:26 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: wcPVjWwaP8iW2tyl4_FNZxBS-dw X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11284 Archived-At: --0015176f16f648f7c40498ec0e57 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello again, Second problem solved as well. The attached patch fixes both issues. Anything else you notice being wrong with ecmascript? (I mean our implementation of it, of course ...) Noah On Sun, Jan 2, 2011 at 10:19 PM, Noah Lavine wrot= e: > Hi all, > > I looked at this. For the first error, I think the bug is in (language > ecmascript compile-tree-il), where the file around line 369 says: > > =A0 =A0 =A0((object . ,args) > =A0 =A0 =A0 =A0 =A0 (@impl new-object > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(map (lambda (x) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (pmatch x > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((,prop ,= val) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(-> (a= pply (-> (primitive 'cons)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 (-> (const prop)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 (comp val e)))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(error= "bad prop-val pair" x)))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 args))) > > This produces (@impl new-object ()) if args is '(), but it should just > be (@impl new-object). I tried changing that bit to > > =A0 =A0 =A0((object . ,args) > =A0 =A0 =A0 (if (null? args) > =A0 =A0 =A0 =A0 =A0 (@impl new-object) > =A0 =A0 =A0 =A0 =A0 (@impl new-object > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(map (lambda (x) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (pmatch x > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((,prop ,= val) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(-> (a= pply (-> (primitive 'cons)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 (-> (const prop)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 (comp val e)))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (else > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(error= "bad prop-val pair" x)))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 args)))) > > and it now works. (It's terribly hackish - does anyone have a better > solution?) I don't have time to look at the rest right now, but I'll > try to soon unless someone else figures it out (please :-) ). > > Noah > > > On Sun, Jan 2, 2011 at 11:46 AM, Kan-Ru Chen wrote: >> Hi, >> >> I recently want to start a small project that uses guile as the >> JavaScript interpreter, but the current git HEAD has errors regard >> object definition. >> >> --8<---------------cut here---------------start------------->8--- >> scheme@(guile-user)> ,L ecmascript >> Happy hacking with ECMAScript! =A0To switch back, type `,L scheme'. >> ecmascript@(guile-user)> var test =3D {}; >> While compiling expression: >> ERROR: unrecognized tree-il () >> ecmascript@(guile-user)> var test =3D { bar: 1 }; >> While compiling expression: >> ERROR: unrecognized tree-il ((apply (primitive cons) (const bar) (const = 1))) >> --8<---------------cut here---------------end--------------->8--- >> >> >> Happy new year! >> Kanru >> -- >> A badly written book is only a blunder. A bad translation of a good >> book is a crime. >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Gilbert Highet >> >> > --0015176f16f648f7c40498ec0e57 Content-Type: application/octet-stream; name="0001-Ecmascript-Compiler-Fix.patch" Content-Disposition: attachment; filename="0001-Ecmascript-Compiler-Fix.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gih1papf0 RnJvbSAwMDMyMzI0MGRhNzAzYzkzNjRiZjllYzBmMTYwYzgxNmY5YWRjMGZiIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBOb2FoIExhdmluZSA8bmxhdmluZUBoYXZlcmZvcmQuZWR1PgpE YXRlOiBNb24sIDMgSmFuIDIwMTEgMDI6MjI6MzUgLTA1MDAKU3ViamVjdDogW1BBVENIXSBFY21h c2NyaXB0IENvbXBpbGVyIEZpeAoKVGhpcyBmaXhlcyB0d28gYnVncyBpbiB0aGUgRUNNQVNjcmlw dCBjb21waWxlciB0aGF0IHdlcmUgYm90aCBmdW5kYW1lbnRhbGx5CmR1ZSB0byBhIGxhY2sgb2Yg c3BsaWNpbmcgaW4gdGhlIGNvbnN0cnVjdGlvbiBvZiBzb21lIHRyZWUtaWwuCi0tLQogbW9kdWxl L2xhbmd1YWdlL2VjbWFzY3JpcHQvY29tcGlsZS10cmVlLWlsLnNjbSB8ICAgMjAgKysrKysrKysr Ky0tLS0tLS0tLS0KIDEgZmlsZXMgY2hhbmdlZCwgMTAgaW5zZXJ0aW9ucygrKSwgMTAgZGVsZXRp b25zKC0pCgpkaWZmIC0tZ2l0IGEvbW9kdWxlL2xhbmd1YWdlL2VjbWFzY3JpcHQvY29tcGlsZS10 cmVlLWlsLnNjbSBiL21vZHVsZS9sYW5ndWFnZS9lY21hc2NyaXB0L2NvbXBpbGUtdHJlZS1pbC5z Y20KaW5kZXggYTk3ZTU1NS4uYTUyNzZhYiAxMDA2NDQKLS0tIGEvbW9kdWxlL2xhbmd1YWdlL2Vj bWFzY3JpcHQvY29tcGlsZS10cmVlLWlsLnNjbQorKysgYi9tb2R1bGUvbGFuZ3VhZ2UvZWNtYXNj cmlwdC9jb21waWxlLXRyZWUtaWwuc2NtCkBAIC0zNjYsMTYgKzM2NiwxNiBAQAogICAgICAgIGAo YXBwbHkgLChAaW1wbHYgbmV3LWFycmF5KQogICAgICAgICAgICAgICAgLEAobWFwIChsYW1iZGEg KHgpIChjb21wIHggZSkpIGFyZ3MpKSkKICAgICAgICgob2JqZWN0IC4gLGFyZ3MpCi0gICAgICAg KEBpbXBsIG5ldy1vYmplY3QKLSAgICAgICAgICAgICAgKG1hcCAobGFtYmRhICh4KQotICAgICAg ICAgICAgICAgICAgICAgKHBtYXRjaCB4Ci0gICAgICAgICAgICAgICAgICAgICAgICgoLHByb3Ag LHZhbCkKLSAgICAgICAgICAgICAgICAgICAgICAgICgtPiAoYXBwbHkgKC0+IChwcmltaXRpdmUg J2NvbnMpKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoLT4gKGNvbnN0IHBy b3ApKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoY29tcCB2YWwgZSkpKSkK LSAgICAgICAgICAgICAgICAgICAgICAgKGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIChl cnJvciAiYmFkIHByb3AtdmFsIHBhaXIiIHgpKSkpCi0gICAgICAgICAgICAgICAgICAgYXJncykp KQorICAgICAgIGAoYXBwbHkgKEAgKGxhbmd1YWdlIGVjbWFzY3JpcHQgaW1wbCkgbmV3LW9iamVj dCkKKyAgICAgICAgICAgICAgICxAKG1hcCAobGFtYmRhICh4KQorICAgICAgICAgICAgICAgICAg ICAgICAgIChwbWF0Y2ggeAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCgscHJv cCAsdmFsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgtPiAoYXBwbHkgKC0+ IChwcmltaXRpdmUgJ2NvbnMpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKC0+IChjb25zdCBwcm9wKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIChjb21wIHZhbCBlKSkpKQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZXJyb3Ig ImJhZCBwcm9wLXZhbCBwYWlyIiB4KSkpKQorICAgICAgICAgICAgICAgICAgICAgICBhcmdzKSkp CiAgICAgICAoKHByZWYgLG9iaiAscHJvcCkKICAgICAgICAoQGltcGwgcGdldAogICAgICAgICAg ICAgICAoY29tcCBvYmogZSkKLS0gCjEuNy4zLjIKCg== --0015176f16f648f7c40498ec0e57--