From 34e415abdc3bf78c0c065f549c945c55012050b8 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 9 Feb 2003 01:58:09 +0000 Subject: [PATCH] Fix bug in output of LETREC expressions: internal definitions within the LETREC must be rewritten as a nested LETREC. Previously they were merged into the outer LETREC. --- v7/src/runtime/syntax-output.scm | 63 ++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/v7/src/runtime/syntax-output.scm b/v7/src/runtime/syntax-output.scm index 53021bd48..4ae043c9a 100644 --- a/v7/src/runtime/syntax-output.scm +++ b/v7/src/runtime/syntax-output.scm @@ -1,25 +1,26 @@ -;;; -*-Scheme-*- -;;; -;;; $Id: syntax-output.scm,v 14.6 2002/11/20 19:46:23 cph Exp $ -;;; -;;; Copyright (c) 1989-1991, 2001, 2002 Massachusetts Institute of Technology -;;; -;;; This file is part of MIT Scheme. -;;; -;;; MIT Scheme is free software; you can redistribute it and/or modify -;;; it under the terms of the GNU General Public License as published -;;; by the Free Software Foundation; either version 2 of the License, -;;; or (at your option) any later version. -;;; -;;; MIT Scheme is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with MIT Scheme; if not, write to the Free Software -;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -;;; 02111-1307, USA. +#| -*-Scheme-*- + +$Id: syntax-output.scm,v 14.7 2003/02/09 01:58:09 cph Exp $ + +Copyright 1989,1990,1991,2001,2002,2003 Massachusetts Institute of Technology + +This file is part of MIT Scheme. + +MIT Scheme is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2 of the License, or (at your +option) any later version. + +MIT Scheme is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with MIT Scheme; if not, write to the Free Software Foundation, +Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +|# ;;;; Syntaxer Output Interface @@ -95,11 +96,19 @@ (output/combination (output/named-lambda lambda-tag:let names body) values)) (define (output/letrec names values body) - (output/let '() '() - (output/body '() - (make-sequence - (append! (map make-definition names values) - (list body)))))) + (output/let names + (map (lambda (name) name (output/unassigned)) names) + (make-sequence + (map* (list (scan-defines body + (lambda (names declarations body) + (if (or (pair? names) + (pair? declarations)) + (output/let '() '() + (make-open-block names + declarations + body)) + body)))) + output/assignment names values)))) (define (output/body declarations body) (scan-defines (let ((declarations (apply append declarations))) -- 2.25.1