Closed xingzheone closed 2 years ago
guile implement is here
https://github.com/cky/guile/blob/stable-2.0/module/ice-9/psyntax-pp.scm
chezscheme ? 😠😠can't find... Very sad
You have actually found the Chez Scheme definition of syntax-case. Most of Chez Scheme, including syntax-case, is implemented in Chez Scheme. The only difficulty with implementing a Scheme compiler in Scheme is that you must use another Scheme compiler to compile it. In the case of Chez Scheme, we simply use an earlier build of Chez Scheme when compiling the latest build. This is referred to as bootstrapping. At some point in the past, when syntax-case was first added to Chez Scheme, the pattern matching you see being done by syntax-case to implement syntax-case had to be done with more primitive code, but this was discarded in favor of the more high-level code at some point after we had a compiler capable of handling it. Note that syntax-case (of the earlier build) is used only (to generate the code) to parse syntax-case forms and subforms; in particular, syntax-case forms are not merely expanded into syntax-case forms, which would be magical.
Incidentally, if the code still works as originally designed, Guile's psyntax-pp.scm is actually generated from psyntax.scm using an earlier build of psyntax.scm/psyntax-pp.scm.
dybvig ,thanks very much . This question is very important to me. You are a good teacher.
sorry , Had to reopen . when i'm read https://scheme.com/syntax-case/r6rs-libraries/index.html and read expander.ss
(library (psyntax expander)
(export identifier? syntax-dispatch environment environment?
eval expand generate-temporaries free-identifier=?
bound-identifier=? datum->syntax syntax-error
syntax->datum make-variable-transformer
eval-r6rs-top-level boot-library-expand eval-top-level
null-environment)
(import
......
(psyntax internal)
(only (rnrs syntax-case) syntax-case syntax with-syntax) ;; here!! use ikarus binary .....
(prefix (rnrs syntax-case) sys.))
It seems to be in a dead circle Can the implementation of the first version of the 'syntax-case' be found ?
syntax.ss 与 scheme è¯æ³• syntax-case 基本上了解了. 分享下:
https://cisco.github.io/ChezScheme/csug9.5/libraries.html#./libraries:h0
syntax.ss 类似于 parser syntax-case 是内置的top-level 类似于clojure ä¸çš„specials
in syntax.ss I find this
There are no other places. Where is the first definition syntax-case .
(Sorry, I'm a beginner,)