On this page:
syntax-serialize
syntax-deserialize

12.10 Serializing Syntax

procedure

(syntax-serialize 
  stx 
  #:preserve-property-keys preserve-property-keys 
  [#:provides-namespace provides-namespace 
  #:base-module-path-index base-module-path-index]) 
  any/c
  stx : syntax?
  preserve-property-keys : (listof symbol?)
  provides-namespace : (or/c namespace? #f)
   = (current-namespace)
  base-module-path-index : (or/c module-path-index? #f) = #f
Converts stx to a serialized form that is suitable for use with s-exp->fasl or serialize. Although stx could be serialized with (compile `(quote-syntax ,stx)) and then writing the compiled form, syntax-serialize provides more control over serialization:

A serialized syntax object is otherwise similar to compiled code: it is version-specific, and deserialization will require a sufficiently powerful code inspector.

Added in version 8.0.0.13 of package base.

procedure

(syntax-deserialize 
  v 
  [#:base-module-path-index base-module-path-index]) 
  syntax?
  v : any/c
  base-module-path-index : (or/c module-path-index? #f) = #f
Converts the result of syntax-serialize back to a syntax object. See syntax-serialize for more information.

Added in version 8.0.0.13 of package base.