From: Chris Hanson Date: Thu, 30 Apr 1998 21:28:38 +0000 (+0000) Subject: Add mechanism to associate syntax tables with environments. X-Git-Tag: 20090517-FFI~4805 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=38a99c9f9fe49fe3ab5a8cee2a2245573b802fef;p=mit-scheme.git Add mechanism to associate syntax tables with environments. --- diff --git a/v7/src/runtime/global.scm b/v7/src/runtime/global.scm index 5c01b769b..1c3dcc36f 100644 --- a/v7/src/runtime/global.scm +++ b/v7/src/runtime/global.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: global.scm,v 14.48 1995/05/03 21:37:11 adams Exp $ +$Id: global.scm,v 14.49 1998/04/30 21:28:38 cph Exp $ Copyright (c) 1988-93 Massachusetts Institute of Technology @@ -91,7 +91,8 @@ MIT in each case. |# (define apply (ucode-primitive apply 2)) (define (eval expression environment) - (extended-scode-eval (syntax expression system-global-syntax-table) + (extended-scode-eval (syntax expression + (environment-syntax-table environment)) environment)) (define (scode-eval scode environment) diff --git a/v7/src/runtime/runtime.pkg b/v7/src/runtime/runtime.pkg index c1d04c0d4..ff50d5ad0 100644 --- a/v7/src/runtime/runtime.pkg +++ b/v7/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.297 1998/04/30 18:06:04 cph Exp $ +$Id: runtime.pkg,v 14.298 1998/04/30 21:28:17 cph Exp $ Copyright (c) 1988-98 Massachusetts Institute of Technology @@ -3043,12 +3043,14 @@ MIT in each case. |# (files "syntax") (parent ()) (export () + environment-syntax-table hook/syntax-expression lambda-tag:fluid-let lambda-tag:let lambda-tag:make-environment lambda-tag:unnamed make-syntax-closure + set-environment-syntax-table! syntax syntax* syntax-closure/expression diff --git a/v7/src/runtime/syntax.scm b/v7/src/runtime/syntax.scm index ed7a11e9a..bdc53e112 100644 --- a/v7/src/runtime/syntax.scm +++ b/v7/src/runtime/syntax.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Id: syntax.scm,v 14.28 1997/12/02 05:53:21 adams Exp $ +$Id: syntax.scm,v 14.29 1998/04/30 21:28:01 cph Exp $ -Copyright (c) 1988-97 Massachusetts Institute of Technology +Copyright (c) 1988-98 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -45,6 +45,8 @@ MIT in each case. |# (make-syntax-table system-global-syntax-table)) (set! *disallow-illegal-definitions?* #t) (set! hook/syntax-expression default/syntax-expression) + (set-environment-syntax-table! system-global-environment + system-global-syntax-table) unspecific) (define system-global-syntax-table) @@ -126,6 +128,16 @@ MIT in each case. |# (define (syntax/top-level?) *syntax-top-level?*) + +(define (environment-syntax-table environment) + (lexical-reference environment syntax-table-tag)) + +(define (set-environment-syntax-table! environment table) + (local-assignment environment syntax-table-tag table)) + +(define-integrable syntax-table-tag + ((ucode-primitive string->symbol) + "#[(runtime syntax-table)syntax-table-tag]")) (define-integrable (syntax-subsequence expressions) (syntax-sequence #f expressions)) diff --git a/v8/src/runtime/global.scm b/v8/src/runtime/global.scm index 035792055..ef6aa5ac5 100644 --- a/v8/src/runtime/global.scm +++ b/v8/src/runtime/global.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: global.scm,v 14.53 1997/07/09 14:40:07 adams Exp $ +$Id: global.scm,v 14.54 1998/04/30 21:28:12 cph Exp $ Copyright (c) 1988-1996 Massachusetts Institute of Technology @@ -91,7 +91,8 @@ MIT in each case. |# (define apply (ucode-primitive apply 2)) (define (eval expression environment) - (extended-scode-eval (syntax expression system-global-syntax-table) + (extended-scode-eval (syntax expression + (environment-syntax-table environment)) environment)) (define (scode-eval scode environment) diff --git a/v8/src/runtime/runtime.pkg b/v8/src/runtime/runtime.pkg index 4d022d052..0e21ce033 100644 --- a/v8/src/runtime/runtime.pkg +++ b/v8/src/runtime/runtime.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: runtime.pkg,v 14.303 1998/04/30 18:05:39 cph Exp $ +$Id: runtime.pkg,v 14.304 1998/04/30 21:28:23 cph Exp $ Copyright (c) 1988-98 Massachusetts Institute of Technology @@ -3047,12 +3047,14 @@ MIT in each case. |# (files "syntax") (parent ()) (export () + environment-syntax-table hook/syntax-expression lambda-tag:fluid-let lambda-tag:let lambda-tag:make-environment lambda-tag:unnamed make-syntax-closure + set-environment-syntax-table! syntax syntax* syntax-closure/expression