From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.user Subject: Compilation to js [Update] Date: Tue, 20 Jun 2017 19:43:24 +0100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1497984241 8777 195.159.176.226 (20 Jun 2017 18:44:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Jun 2017 18:44:01 +0000 (UTC) To: "guile-user@gnu.org" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 20 20:43:56 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNO83-0001t9-KV for guile-user@m.gmane.org; Tue, 20 Jun 2017 20:43:55 +0200 Original-Received: from localhost ([::1]:50233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNO88-00074g-RR for guile-user@m.gmane.org; Tue, 20 Jun 2017 14:44:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNO7c-00071c-Lx for guile-user@gnu.org; Tue, 20 Jun 2017 14:43:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNO7b-0003N9-Gd for guile-user@gnu.org; Tue, 20 Jun 2017 14:43:28 -0400 Original-Received: from mail-it0-x232.google.com ([2607:f8b0:4001:c0b::232]:38195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNO7b-0003LR-Al for guile-user@gnu.org; Tue, 20 Jun 2017 14:43:27 -0400 Original-Received: by mail-it0-x232.google.com with SMTP id b205so19465068itg.1 for ; Tue, 20 Jun 2017 11:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=X0dqjs0tdD7DlqrV6HShDEWAjwBSMT8a21l6sYFiwwI=; b=glcVF3132TxTb5rOvmUbuaEMWbA10q2A8sURI+WOz1PcROpIcpTIXM00xFtVe8nPUF PxBNENK1Edsca1Y9RptUEY5KRnvCAGE/B5NUJw/j8TTqbIs6JlSnjlKhwGazgi10hYjs +OuCUkuwWZd7LC/jnu0eZH+IVE+yUH9O2eUIsYtLelHOB2JwEYT4gLBD1iG0GLtuPx0P C/gCPJ9y69H8dlP4aSgUo4i1QaDKMH7M+PIdML513D7CbfiCyWxUapOtzwFXJuAQOuPa n5TIwNDcpJBo2udhsQH3DmZCS0rPNM7+f0I1kBvhzYwlKsApeoRKXrFWGtSD3ZGF4IEx R/Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=X0dqjs0tdD7DlqrV6HShDEWAjwBSMT8a21l6sYFiwwI=; b=JTNquAixYZUQiEJtvlAQJ9W//58Zt1aOAwjBn2Zx/xs8Su7jeiEdb8GkWsJw4hjToD TrnBXGtdc0Z+jT0Ew32VZEHYwPT5trwV9OPvabU+0sDkdVynNeHEfxhrRMYrgLcJJMxk 85iA0PuAnoqId3V4lL/sF8OudsN9KtiN6b+9eoqVVNDRGfOP/otvcIs1bxmMnmHPsMuf KDwMAVRUSrGedgMou/jf6xmJp4mY+YOLM23JDx2boOjchNjo3Xj7UZeo/gQRIi2YUW2U al5m7TSG7YAfSkZaEhJ1/vg6a2MLTIoVwTIOMYY9b+oO6kqzDrLYD1vh4rBvabkhGj8H 6PTg== X-Gm-Message-State: AKS2vOw1RZG4GFShKIA97htZxZ2bSyqdwBKoK061of+LkQ12YNDLfsQa NkvYMZJs6RhZqo3IJwFrq+FHKz7ydjmSlAo= X-Received: by 10.36.167.65 with SMTP id s1mr5015370iti.98.1497984204597; Tue, 20 Jun 2017 11:43:24 -0700 (PDT) Original-Received: by 10.107.167.14 with HTTP; Tue, 20 Jun 2017 11:43:24 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::232 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13852 Archived-At: Hello guilers, I figure it's time for an update on what I've been working on for the past two weeks. I have mainly been working on updating the compiler to go from the old cps representation to the new cps-soup representation. This had a few false starts, but on the third attempt, I think the approach using the dominator functions in (language cps utils) is the right way, and is giving the results I want. I intend to write a blog post shortly explaining how dominators / cps-soup work and how to compile from it for other people who may be interested in these low level guile details. Right now, you can find my code on gitlab[0] in the compile-to-js-2017 branch in the language/js-il and language/javascript directories[1]. What can you do with it? Well, I do not recommend trying to use this seriously, since you will run into a large number of issues, relating to residualising macros, missing prelude functions and possibly stack overflows. That said, you can take some scheme files and compile them with the usual functions, e.g. (compile-file "/tmp/foo.scm" #:to 'javascript #:output-file "/tmp/foo.js") You can see the output of mergesort (beautified) at http://shift-reset.com/pastes/msort2017.js.html. In order to run it, you will need to add the contents of runtime.js which can be found in language/js-il. Other things you might try are non-local escapes with call/cc and keyword/optional/case-lambda arguments. What's next? Number 2 on my list from last time was > Complete porting boot-9 to js (in particular, the guile module system) so this is what I intend to do. This will allow us to run much more complicated programs, and you won't need to keep reimplementing functions like map. Another issue is with macros, which are not being residualised now that their representation was changed, so I'll do that too. Till next update, Ian [0] https://gitlab.com/ijp/guile/tree/compile-to-js-2017. [1] Compilation to js-il is in language/cps/compile-js.scm