mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-09 02:50:20 +02:00
store special operators in the function slot
If the function slot of a symbol contains a pair with `special-operator' in the car and a procedure in the cdr, the procedure is called to compile the form to Tree-IL. This is similar to other Emacs Lisp implementations, in which special operators are subrs. * module/language/elisp/compile-tree-il.scm: Restructured to store special operator definitions in the function slot. Import `(language elisp runtime)' for `defspecial'. Export special operators so that `(language elisp runtime function-slot)' can re-export them. (backquote?): Removed; the backquote symbol is defined as a special operator, so it's no longer used in `compile-pair'. (is-macro?, get-macro): Replaced by `find-operator'. (find-operator): New procedure. (compile-progn, compile-if, compile-defconst, compile-defvar, compile-setq, compile-let, compile-lexical-let, compile-flet, compile-let*, compile-lexical-let*, compile-flet*, compile-without-void-checks, compile-with-always-lexical, compile-guile-ref, compile-guile-primitive, compile-while, compile-function, compile-defmacro, compile-defun, #{compile-`}#, compile-quote): New special operators with definitions taken from the pmatch form in `compile-pair'. There is no special operator `lambda'; it is now a macro, as in other Elisp implementations. (compile-pair): Instead of directly compiling special forms, check for a special operator object in the function slot. * module/language/elisp/runtime.scm: Export `defspecial'. (make-id): New function. (built-in-macro): Prefix macros with `macro-'. (defspecial): New syntax. * module/language/elisp/runtime/function-slot.scm: Import and re-export special operators. Rename imported special operators and macros to remove prefixes. Re-export new macro `lambda'. * module/language/elisp/runtime/macros.scm (macro-lambda): New Elisp macro.
This commit is contained in:
parent
1d7a1b8e0f
commit
7d6816f0c7
4 changed files with 315 additions and 216 deletions
|
@ -27,6 +27,10 @@
|
|||
;;; during compilation, of course, so not really in runtime. But I think
|
||||
;;; it fits well to the others here.
|
||||
|
||||
(built-in-macro lambda
|
||||
(lambda cdr
|
||||
`(function (lambda ,@cdr))))
|
||||
|
||||
;;; The prog1 and prog2 constructs can easily be defined as macros using
|
||||
;;; progn and some lexical-let's to save the intermediate value to
|
||||
;;; return at the end.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue