From: admin Date: Fri, 22 Sep 2023 09:05:45 +0000 (+0900) Subject: Define a language to use curried functions in the REPL X-Git-Tag: v0.1.0~6 X-Git-Url: https://git.vouivredigital.com/?a=commitdiff_plain;h=63dd72fe4c1bbd53009ba45f500d27b3b25b9300;p=vouivre.git Define a language to use curried functions in the REPL --- diff --git a/compile-tree-il.scm b/compile-tree-il.scm index d9d2d7a..2884d9c 100644 --- a/compile-tree-il.scm +++ b/compile-tree-il.scm @@ -6,20 +6,26 @@ ;;;; modify it under the terms of the GNU Lesser General Public ;;;; License as published by the Free Software Foundation; either ;;;; version 3 of the License, or (at your option) any later version. -;;;; +;;;; ;;;; This library 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 ;;;; Lesser General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU Lesser General Public ;;;; License along with this library; if not, write to the Free Software ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; This file has been modified by Vouivre Digital Corporation. The exact +;;;; modifications can be seen in a shell using: +;;;; $ git diff 5226e2890df9a25bd1d33514ff67539da7794905 compile-tree-il.scm + ;;; Code: -(define-module (language scheme compile-tree-il) +(define-module (language vdc compile-tree-il) #:use-module (language tree-il) + #:use-module (srfi srfi-71) + #:use-module (vdc curry) #:export (compile-tree-il)) ;;; environment := MODULE @@ -28,6 +34,9 @@ (save-module-excursion (lambda () (set-current-module e) - (let* ((x (macroexpand x 'c '(compile load eval))) - (cenv (current-module))) - (values x cenv cenv))))) + ;; TODO: Why do we need to use `(@@ (vdc curry) symtab)' here instead of + ;; simply `symtab'? If we don't it always return an empty symtab. + (let ((t expr (expand (@@ (vdc curry) symtab) (syntax->datum x)))) + (let* ((x (macroexpand expr 'c '(compile load eval))) + (cenv (current-module))) + (values x cenv cenv)))))) diff --git a/decompile-tree-il.scm b/decompile-tree-il.scm index 99edee4..b9a177d 100644 --- a/decompile-tree-il.scm +++ b/decompile-tree-il.scm @@ -6,19 +6,23 @@ ;;;; modify it under the terms of the GNU Lesser General Public ;;;; License as published by the Free Software Foundation; either ;;;; version 3 of the License, or (at your option) any later version. -;;;; +;;;; ;;;; This library 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 ;;;; Lesser General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU Lesser General Public ;;;; License along with this library; if not, write to the Free Software ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; This file has been modified by Vouivre Digital Corporation. The exact +;;;; modifications can be seen in a shell using: +;;;; $ git diff 5226e2890df9a25bd1d33514ff67539da7794905 decompile-tree-il.scm + ;;; Code: -(define-module (language scheme decompile-tree-il) +(define-module (language vdc decompile-tree-il) #:use-module (language tree-il) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) diff --git a/spec.scm b/spec.scm index 18af552..abf2777 100644 --- a/spec.scm +++ b/spec.scm @@ -6,31 +6,36 @@ ;;;; modify it under the terms of the GNU Lesser General Public ;;;; License as published by the Free Software Foundation; either ;;;; version 3 of the License, or (at your option) any later version. -;;;; +;;;; ;;;; This library 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 ;;;; Lesser General Public License for more details. -;;;; +;;;; ;;;; You should have received a copy of the GNU Lesser General Public ;;;; License along with this library; if not, write to the Free Software ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; This file has been modified by Vouivre Digital Corporation. The exact +;;;; modifications can be seen in a shell using: +;;;; $ git diff 5226e2890df9a25bd1d33514ff67539da7794905 spec.scm + ;;; Code: -(define-module (language scheme spec) +(define-module (language vdc spec) #:use-module (system base compile) #:use-module (system base language) - #:use-module (language scheme compile-tree-il) - #:use-module (language scheme decompile-tree-il) - #:export (scheme)) + #:use-module (language vdc compile-tree-il) + #:use-module (language vdc decompile-tree-il) + #:use-module (vdc curry) + #:export (vdc)) ;;; ;;; Language definition ;;; -(define-language scheme - #:title "Scheme" +(define-language vdc + #:title "VDC" #:reader (lambda (port env) ;; Use the binding of current-reader from the environment. ;; FIXME: Handle `read-options' as well?