[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 84/99: Add assignment js-type to (language javascript)
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 84/99: Add assignment js-type to (language javascript) |
Date: |
Sun, 10 Oct 2021 21:51:11 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit d4ef33f6cfc6882b0ff02faf2069610b69e74ab4
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Sun Aug 27 22:18:40 2017 +0100
Add assignment js-type to (language javascript)
* module/language/javascript.scm
(assign): new js-type
(print-exp, unparse-js): Handle case.
* module/language/javascript/simplify.scm (flatten-blocks): Handle case.
---
module/language/javascript.scm | 11 +++++++++++
module/language/javascript/simplify.scm | 2 ++
2 files changed, 13 insertions(+)
diff --git a/module/language/javascript.scm b/module/language/javascript.scm
index 8829b3b..4a49435 100644
--- a/module/language/javascript.scm
+++ b/module/language/javascript.scm
@@ -4,6 +4,7 @@
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-9 gnu)
#:export (
+ make-assign assign
make-const const
make-function function
make-return return
@@ -50,6 +51,7 @@
(define (print-js exp port)
(format port "#<js ~S>" (unparse-js exp)))
+(define-js-type assign id exp)
(define-js-type const c)
(define-js-type function args body)
(define-js-type return exp)
@@ -66,6 +68,8 @@
(define (unparse-js exp)
(match exp
+ (($ assign id exp)
+ `(assign ,id ,(unparse-js exp)))
(($ const c)
`(const ,c))
(($ function args body)
@@ -99,6 +103,13 @@
(define (print-exp exp port)
(match exp
+ (($ assign id exp)
+ (print-id id port)
+ (format port " = ")
+ (display "(" port)
+ (print-exp exp port)
+ (display ")" port))
+
(($ const c)
(print-const c port))
diff --git a/module/language/javascript/simplify.scm
b/module/language/javascript/simplify.scm
index 2e3bde5..a26b7fd 100644
--- a/module/language/javascript/simplify.scm
+++ b/module/language/javascript/simplify.scm
@@ -15,6 +15,8 @@
(fold-right flatten '() stmts))
(define (flatten-exp exp)
(match exp
+ (($ assign id exp)
+ (make-assign id (flatten-exp exp)))
(($ const c) exp)
(($ new exp)
(make-new (flatten-exp exp)))
- [Guile-commits] 57/99: Implement built-in syntax procedures., (continued)
- [Guile-commits] 57/99: Implement built-in syntax procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 56/99: Implement builtin list procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 58/99: Implement built-in symbol procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 64/99: Implement procedure built-ins., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 65/99: Implement module built-ins., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 72/99: Implement basic `equal?' implementation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 68/99: struct-set! primitive returns no values, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 71/99: modules should be passed current continuation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 79/99: Implement list builtins, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 80/99: *features* is an empty list, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 84/99: Add assignment js-type to (language javascript),
Christopher Allan Webber <=
- [Guile-commits] 87/99: Create stub module forms for dependecies, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 97/99: Switch use of $closure to $const-fun, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 22/99: Add more Scheme Primitives to runtime.js, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 32/99: Rewrite js-il inliner, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 82/99: pop-fluid uses field of frame not fluid, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 85/99: Handle more JavaScript binary operators, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 86/99: Keywords cannot be both keyword and optional, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 91/99: Update Copyright Headers, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 94/99: Add compiler-chooser for CPS spec, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 96/99: Fix cps's choose-compiler to be able to compile javascript, Christopher Allan Webber, 2021/10/10