[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 49/99: Compile Syntax Objects to Javascript
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 49/99: Compile Syntax Objects to Javascript |
Date: |
Sun, 10 Oct 2021 21:50:57 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit 536d94feb3288c22517e565f45059ec5ea824cc8
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Tue Jun 20 22:50:06 2017 +0100
Compile Syntax Objects to Javascript
* module/language/js-il/compile-javascript.scm (compile-const):
Handle the new syntax object struct.
* module/language/js-il/runtime.js(scheme.Syntax): Add Syntax Object type
---
module/language/js-il/compile-javascript.scm | 8 ++++++++
module/language/js-il/runtime.js | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/module/language/js-il/compile-javascript.scm
b/module/language/js-il/compile-javascript.scm
index ed76441..4ac7820 100644
--- a/module/language/js-il/compile-javascript.scm
+++ b/module/language/js-il/compile-javascript.scm
@@ -6,6 +6,7 @@
#:use-module (language javascript simplify)
#:use-module (language js-il inlining)
#:use-module (system foreign)
+ #:use-module (system syntax internal)
#:export (compile-javascript))
(define (undefined? obj)
@@ -355,5 +356,12 @@
(list (make-const (symbol->string (keyword->symbol c)))))))
((undefined? c)
(make-refine *scheme* (make-const "UNDEFINED")))
+ ((syntax? c)
+ (make-call
+ (make-refine *scheme* (make-const "Syntax"))
+ (map compile-const
+ (list (syntax-expression c)
+ (syntax-wrap c)
+ (syntax-module c)))))
(else
(throw 'uncompilable-const c))))
diff --git a/module/language/js-il/runtime.js b/module/language/js-il/runtime.js
index 6ef6ff1..85669da 100644
--- a/module/language/js-il/runtime.js
+++ b/module/language/js-il/runtime.js
@@ -291,6 +291,14 @@ scheme.primitives["builtin-ref"] = function (idx) {
return scheme.builtins[idx];
};
+// Syntax Objects
+scheme.Syntax = function (expr, wrap, module) {
+ this.expr = expr;
+ this.wrap = wrap;
+ this.module = module;
+ return this;
+};
+
// Modules
scheme.primitives["define!"] = function(sym, obj) {
var b = new scheme.Box(obj);
- [Guile-commits] 17/99: Implement Optional arguments, (continued)
- [Guile-commits] 17/99: Implement Optional arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 27/99: values takes multiple arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 28/99: Implement apply correctly, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 38/99: Explicitly test for undefined arguments to handle false values like 0, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 44/99: Update primitives in no-values-primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 35/99: Change local type representation and remove var type, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 42/99: compile-js uses the new cps representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 43/99: Handle multiple conts in a function body, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 46/99: JS-IL inliner has different count-calls for different clauses, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 40/99: Merge branch 'stable-2.2' into compile-to-js-2017, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 49/99: Compile Syntax Objects to Javascript,
Christopher Allan Webber <=
- [Guile-commits] 39/99: Add missing simplify.scm to Makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 37/99: Fixup binop unparsing, Christopher Allan Webber, 2021/10/10
- [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