mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 09:10:22 +02:00
Implemented unless, when and dotimes using built-in macros.
* module/language/elisp/README: Document that. * module/language/elisp/runtime.scm: Defined built-in-macro macro. * module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes. * test-suite/tests/elisp-compiler.test: Test for those constructs.
This commit is contained in:
parent
570c12aca7
commit
7d1a978289
4 changed files with 92 additions and 20 deletions
|
@ -20,8 +20,8 @@
|
|||
;;; Code:
|
||||
|
||||
(define-module (language elisp runtime)
|
||||
#:export (void nil-value t-value elisp-bool)
|
||||
#:export-syntax (built-in-func))
|
||||
#:export (void nil-value t-value elisp-bool macro-error)
|
||||
#:export-syntax (built-in-func built-in-macro))
|
||||
|
||||
; This module provides runtime support for the Elisp front-end.
|
||||
|
||||
|
@ -38,6 +38,13 @@
|
|||
(define t-value #t)
|
||||
|
||||
|
||||
; Report an error during macro compilation, that means some special compilation
|
||||
; (syntax) error.
|
||||
|
||||
(define (macro-error msg . args)
|
||||
(apply error msg args))
|
||||
|
||||
|
||||
; Convert a scheme boolean to Elisp.
|
||||
|
||||
(define (elisp-bool b)
|
||||
|
@ -46,9 +53,17 @@
|
|||
nil-value))
|
||||
|
||||
|
||||
; Define a predefined function; convenient macro for this task.
|
||||
; Define a predefined function or predefined macro for use in the function-slot
|
||||
; and macro-slot modules, respectively.
|
||||
|
||||
(define-macro (built-in-func name value)
|
||||
`(begin
|
||||
(define-public ,name (make-fluid))
|
||||
(fluid-set! ,name ,value)))
|
||||
(define-syntax built-in-func
|
||||
(syntax-rules ()
|
||||
((_ name value)
|
||||
(begin
|
||||
(define-public name (make-fluid))
|
||||
(fluid-set! name value)))))
|
||||
|
||||
(define-syntax built-in-macro
|
||||
(syntax-rules ()
|
||||
((_ name value)
|
||||
(define-public name value))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue