1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

Add disjoint syntax object type

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (DOT_X_FILES, DOT_DOC_FILES, noinst_HEADERS): Add syntax.c and
  syntax.h.
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (class_syntax, scm_class_of, scm_goops_early_init):
* libguile/init.c (scm_init_guile):
* libguile/print.c (iprin1):
* libguile/tags.h (scm_tc7_syntax):
* module/oop/goops.scm (<syntax>):
* module/system/base/types.scm (%tc7-syntax, cell->object):
* module/system/vm/disassembler.scm (code-annotation): Wire up the new
  data type.
* libguile/syntax.c:
* libguile/syntax.h: New files.
* module/ice-9/boot-9.scm: Move new definitions to (system syntax
  internal).
* module/system/syntax.scm (print-syntax): New helper.
* module/system/vm/assembler.scm (statically-allocatable?)
  (intern-constant, link-data): Arrange to be able to write syntax
  objects into images.
* module/language/cps/types.scm (&syntax): New type.  Remove
  &hash-table; it was never detected, an internal binding, and we need
  the bit to avoid going into bignum territory.
This commit is contained in:
Andy Wingo 2017-03-24 11:17:26 +01:00
parent 6ba3f35f26
commit 64c5cc58fc
15 changed files with 221 additions and 8 deletions

View file

@ -84,6 +84,7 @@
#:use-module (language cps intset)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-11)
#:use-module ((system syntax internal) #:select (syntax?))
#:export (;; Specific types.
&exact-integer
&flonum
@ -112,7 +113,7 @@
&bytevector
&bitvector
&array
&hash-table
&syntax
;; Union types.
&number &real
@ -169,7 +170,7 @@
&bytevector
&bitvector
&array
&hash-table
&syntax
&f64
&u64
@ -348,6 +349,7 @@ minimum, and maximum."
((bytevector? val) (return &bytevector (bytevector-length val)))
((bitvector? val) (return &bitvector (bitvector-length val)))
((array? val) (return &array (array-rank val)))
((syntax? val) (return &syntax 0))
((not (variable-bound? (make-variable val))) (return &unbound #f))
(else (error "unhandled constant" val))))