On this page:
10.1 API for Decompiling
decompile
10.2 API for Parsing Bytecode
zo-parse
10.3 API for Marshaling Bytecode
zo-marshal-to
zo-marshal
10.4 Bytecode Representation
zo
10.4.1 Prefix
compilation-top
prefix
global-bucket
module-variable
function-shape
struct-shape
struct-type-shape
constructor-shape
predicate-shape
accessor-shape
mutator-shape
struct-other-shape
stx
10.4.2 Forms
form
def-values
def-syntaxes
seq-for-syntax
req
seq
splice
inline-variant
mod
provided
10.4.3 Expressions
expr
lam
closure
case-lam
let-one
let-void
install-value
let-rec
boxenv
localref
toplevel
topsyntax
application
branch
with-cont-mark
beg0
varref
assign
apply-values
primval
10.4.4 Syntax Objects
wrapped
wrap
top-level-rename
mark-barrier
free-id-info
lexical-rename
phase-shift
module-rename
all-from-module
module-binding
simple-module-binding
phased-module-binding
exported-nominal-module-binding
nominal-module-binding
exported-module-binding
nominal-path
simple-nominal-path
imported-nominal-path
phased-nominal-path

10 raco decompile: Decompiling Bytecode

The raco decompile command takes a bytecode file (which usually has the file extension ".zo") or a source file with an associated bytecode file (usually created with raco make) and converts it back to an approximation of Racket code. Decompiled bytecode is mostly useful for checking the compiler’s transformation and optimization of the source program.

Many forms in the decompiled code, such as module, define, and lambda, have the same meanings as always. Other forms and transformations are specific to the rendering of bytecode, and they reflect a specific execution model:

10.1 API for Decompiling

 (require compiler/decompile)

procedure

(decompile top)  any/c

  top : compilation-top?
Consumes the result of parsing bytecode and returns an S-expression (as described above) that represents the compiled code.

10.2 API for Parsing Bytecode

 (require compiler/zo-parse)

The compiler/zo-parse module re-exports compiler/zo-structs in addition to zo-parse.

procedure

(zo-parse [in])  compilation-top?

  in : input-port? = (current-input-port)
Parses a port (typically the result of opening a ".zo" file) containing bytecode. Beware that the structure types used to represent the bytecode are subject to frequent changes across Racket versons.

The parsed bytecode is returned in a compilation-top structure. For a compiled module, the compilation-top structure will contain a mod structure. For a top-level sequence, it will normally contain a seq or splice structure with a list of top-level declarations and expressions.

The bytecode representation of an expression is closer to an S-expression than a traditional, flat control string. For example, an if form is represented by a branch structure that has three fields: a test expression, a “then” expression, and an “else” expression. Similarly, a function call is represented by an application structure that has a list of argument expressions.

Storage for local variables or intermediate values (such as the arguments for a function call) is explicitly specified in terms of a stack. For example, execution of an application structure reserves space on the stack for each argument result. Similarly, when a let-one structure (for a simple let) is executed, the value obtained by evaluating the right-hand side expression is pushed onto the stack, and then the body is evaluated. Local variables are always accessed as offsets from the current stack position. When a function is called, its arguments are passed on the stack. A closure is created by transferring values from the stack to a flat closure record, and when a closure is applied, the saved values are restored on the stack (though possibly in a different order and likely in a more compact layout than when they were captured).

When a sub-expression produces a value, then the stack pointer is restored to its location from before evaluating the sub-expression. For example, evaluating the right-hand size for a let-one structure may temporarily push values onto the stack, but the stack is restored to its pre-let-one position before pushing the resulting value and continuing with the body. In addition, a tail call resets the stack pointer to the position that follows the enclosing function’s arguments, and then the tail call continues by pushing onto the stack the arguments for the tail-called function.

Values for global and module-level variables are not put directly on the stack, but instead stored in “buckets,” and an array of accessible buckets is kept on the stack. When a closure body needs to access a global variable, the closure captures and later restores the bucket array in the same way that it captured and restores a local variable. Mutable local variables are boxed similarly to global variables, but individual boxes are referenced from the stack and closures.

Quoted syntax (in the sense of quote-syntax) is treated like a global variable, because it must be instantiated for an appropriate phase. A prefix structure within a compilation-top or mod structure indicates the list of global variables and quoted syntax that need to be instantiated (and put into an array on the stack) before evaluating expressions that might use them.

10.3 API for Marshaling Bytecode

 (require compiler/zo-marshal)

procedure

(zo-marshal-to top out)  void?

  top : compilation-top?
  out : output-port?
Consumes a representation of bytecode and writes it to out.

procedure

(zo-marshal top)  bytes?

  top : compilation-top?
Consumes a representation of bytecode and generates a byte string for the marshaled bytecode.

10.4 Bytecode Representation

 (require compiler/zo-structs)

The compiler/zo-structs library defines the bytecode structures that are produced by zo-parse and consumed by decompile and zo-marshal.

struct

(struct zo ()
  #:extra-constructor-name make-zo
  #:prefab)
A supertype for all forms that can appear in compiled code.

10.4.1 Prefix

struct

(struct compilation-top zo (max-let-depth prefix code)
  #:extra-constructor-name make-compilation-top
  #:prefab)
  max-let-depth : exact-nonnegative-integer?
  prefix : prefix?
  code : (or/c form? any/c)
Wraps compiled code. The max-let-depth field indicates the maximum stack depth that code creates (not counting the prefix array). The prefix field describes top-level variables, module-level variables, and quoted syntax-objects accessed by code. The code field contains executable code; it is normally a form, but a literal value is represented as itself.

struct

(struct prefix zo (num-lifts toplevels stxs)
  #:extra-constructor-name make-prefix
  #:prefab)
  num-lifts : exact-nonnegative-integer?
  toplevels : 
(listof (or/c #f symbol? global-bucket?
              module-variable?))
  stxs : (listof stx?)
Represents a “prefix” that is pushed onto the stack to initiate evaluation. The prefix is an array, where buckets holding the values for toplevels are first, then the buckets for the stxs, then a bucket for another array if stxs is non-empty, then num-lifts extra buckets for lifted local procedures.

In toplevels, each element is one of the following:
  • a #f, which indicates a dummy variable that is used to access the enclosing module/namespace at run time;

  • a symbol, which is a reference to a variable defined in the enclosing module;

  • a global-bucket, which is a top-level variable (appears only outside of modules); or

  • a module-variable, which indicates a variable imported from another module.

The variable buckets and syntax objects that are recorded in a prefix are accessed by toplevel and topsyntax expression forms.

struct

(struct global-bucket zo (name)
  #:extra-constructor-name make-global-bucket
  #:prefab)
  name : symbol?
Represents a top-level variable, and used only in a prefix.

struct

(struct module-variable zo (modidx sym pos phase constantness)
  #:extra-constructor-name make-module-variable
  #:prefab)
  modidx : module-path-index?
  sym : symbol?
  pos : exact-integer?
  phase : exact-nonnegative-integer?
  constantness : 
(or/c #f 'constant 'fixed
      function-shape? struct-shape?)
Represents a top-level variable, and used only in a prefix. The pos may record the variable’s offset within its module, or it can be -1 if the variable is always located by name. The phase indicates the phase level of the definition within its module. The constantness field is either 'constant, a function-shape value, or a struct-shape value to indicate that variable’s value is always the same for every instantiation of its module; 'fixed to indicate that it doesn’t change within a particular instantiation of the module; or #f to indicate that the variable’s value can change even for one particular instantiation of its module.

struct

(struct function-shape (arity preserves-marks?)
  #:extra-constructor-name make-function-shape
  #:prefab)
  arity : procedure-arity?
  preserves-marks? : boolean?
Represents the shape of an expected import, which should be a function having the arity specified by arity. The preserves-marks? field is true if calling the function is expected to leave continuation marks unchanged by the time it returns.

struct

(struct struct-shape ()
  #:extra-constructor-name make-struct-shape
  #:prefab)

struct

(struct struct-type-shape struct-shape (field-count)
  #:extra-constructor-name make-struct-type-shape
  #:prefab)
  field-count : exact-nonnegative-integer?

struct

(struct constructor-shape struct-shape (arity)
  #:extra-constructor-name make-constructor-shape
  #:prefab)
  arity : exact-nonnegative-integer?

struct

(struct predicate-shape struct-shape ()
  #:extra-constructor-name make-predicate-shape
  #:prefab)

struct

(struct accessor-shape struct-shape (field-count)
  #:extra-constructor-name make-accessor-shape
  #:prefab)
  field-count : exact-nonnegative-integer?

struct

(struct mutator-shape struct-shape (field-count)
  #:extra-constructor-name make-mutator-shape
  #:prefab)
  field-count : exact-nonnegative-integer?

struct

(struct struct-other-shape struct-shape ()
  #:extra-constructor-name make-struct-other-shape
  #:prefab)
Represents the shape of an expected import as a structure-type binding, constructor, etc.

struct

(struct stx zo (encoded)
  #:extra-constructor-name make-stx
  #:prefab)
  encoded : wrapped?
Wraps a syntax object in a prefix.

10.4.2 Forms

struct

(struct form zo ()
  #:extra-constructor-name make-form
  #:prefab)
A supertype for all forms that can appear in compiled code (including exprs), except for literals that are represented as themselves.

struct

(struct def-values form (ids rhs)
  #:extra-constructor-name make-def-values
  #:prefab)
  ids : (listof toplevel?)
  rhs : (or/c expr? seq? inline-variant? any/c)
Represents a define-values form. Each element of ids will reference via the prefix either a top-level variable or a local module variable.

After rhs is evaluated, the stack is restored to its depth from before evaluating rhs.

struct

(struct def-syntaxes form (ids rhs prefix max-let-depth dummy)
  #:extra-constructor-name make-def-syntaxes
  #:prefab)
  ids : (listof symbol?)
  rhs : (or/c expr? seq? any/c)
  prefix : prefix?
  max-let-depth : exact-nonnegative-integer?
  dummy : (or/c toplevel? #f)

struct

(struct seq-for-syntax form (forms prefix max-let-depth dummy)
  #:extra-constructor-name make-seq-for-syntax
  #:prefab)
  forms : (listof (or/c form? any/c))
  prefix : prefix?
  max-let-depth : exact-nonnegative-integer?
  dummy : (or/c toplevel? #f)
Represents a define-syntaxes or begin-for-syntax form. The rhs expression or set of forms forms has its own prefix, which is pushed before evaluating rhs or the forms; the stack is restored after obtaining the result values. The max-let-depth field indicates the maximum size of the stack that will be created by rhs (not counting prefix). The dummy variable is used to access the enclosing namespace.

struct

(struct req form (reqs dummy)
  #:extra-constructor-name make-req
  #:prefab)
  reqs : stx?
  dummy : toplevel?
Represents a top-level #%require form (but not one in a module form) with a sequence of specifications reqs. The dummy variable is used to access the top-level namespace.

struct

(struct seq form (forms)
  #:extra-constructor-name make-seq
  #:prefab)
  forms : (listof (or/c form? any/c))
Represents a begin form, either as an expression or at the top level (though the latter is more commonly a splice form). When a seq appears in an expression position, its forms are expressions.

After each form in forms is evaluated, the stack is restored to its depth from before evaluating the form.

struct

(struct splice form (forms)
  #:extra-constructor-name make-splice
  #:prefab)
  forms : (listof (or/c form? any/c))
Represents a top-level begin form where each evaluation is wrapped with a continuation prompt.

After each form in forms is evaluated, the stack is restored to its depth from before evaluating the form.

struct

(struct inline-variant form (direct inline)
  #:extra-constructor-name make-inline-variant
  #:prefab)
  direct : expr?
  inline : expr?
Represents a function that is bound by define-values, where the function has two variants. The first variant is used for normal calls to the function. The second may be used for cross-module inlining of the function.

struct

(struct mod form (name
    srcname
    self-modidx
    prefix
    provides
    requires
    body
    syntax-bodies
    unexported
    max-let-depth
    dummy
    lang-info
    internal-context
    pre-submodules
    post-submodules)
  #:extra-constructor-name make-mod
  #:prefab)
  name : (or/c symbol? (listof symbol?))
  srcname : symbol?
  self-modidx : module-path-index?
  prefix : prefix?
  provides : 
(listof (list/c (or/c exact-integer? #f)
                (listof provided?)
                (listof provided?)))
  requires : 
(listof (cons/c (or/c exact-integer? #f)
                (listof module-path-index?)))
  body : (listof (or/c form? any/c))
  syntax-bodies : 
(listof (cons/c exact-positive-integer?
                (listof (or/c def-syntaxes?
                              seq-for-syntax?))))
  unexported : 
(listof (list/c exact-nonnegative-integer?
                (listof symbol?)
                (listof symbol?)))
  max-let-depth : exact-nonnegative-integer?
  dummy : toplevel?
  lang-info : (or/c #f (vector/c module-path? symbol? any/c))
  internal-context : (or/c #f #t stx? (vectorof stx?))
  pre-submodules : (listof mod?)
  post-submodules : (listof mod?)
Represents a module declaration.

The provides and requires lists are each an association list from phases to exports or imports. In the case of provides, each phase maps to two lists: one for exported variables, and another for exported syntax. In the case of requires, each phase maps to a list of imported module paths.

The body field contains the module’s run-time (i.e., phase 0) code. The syntax-bodies list has a list of forms for each higher phase in the module body; the phases are in order starting with phase 1. The body forms use prefix, rather than any prefix in place for the module declaration itself, while members of lists in syntax-bodies have their own prefixes. After each form in body or syntax-bodies is evaluated, the stack is restored to its depth from before evaluating the form.

The unexported list contains lists of symbols for unexported definitions that can be accessed through macro expansion and that are implemented through the forms in body and syntax-bodies. Each list in unexported starts with a phase level.

The max-let-depth field indicates the maximum stack depth created by body forms (not counting the prefix array). The dummy variable is used to access to the top-level namespace.

The lang-info value specifies an optional module path that provides information about the module’s implementation language.

The internal-module-context value describes the lexical context of the body of the module. This value is used by module->namespace. A #f value means that the context is unavailable or empty. A #t value means that the context is computed by re-importing all required modules. A syntax-object value embeds an arbitrary lexical context.

struct

(struct provided (name src src-name nom-src src-phase protected?)
  #:extra-constructor-name make-provided
  #:prefab)
  name : symbol?
  src : (or/c module-path-index? #f)
  src-name : symbol?
  nom-src : (or/c module-path-index? #f)
  src-phase : exact-nonnegative-integer?
  protected? : boolean?
Describes an individual provided identifier within a mod instance.

10.4.3 Expressions

struct

(struct expr form ()
  #:extra-constructor-name make-expr
  #:prefab)
A supertype for all expression forms that can appear in compiled code, except for literals that are represented as themselves and some seq structures (which can appear as an expression as long as it contains only other things that can be expressions).

struct

(struct lam expr (name
    flags
    num-params
    param-types
    rest?
    closure-map
    closure-types
    toplevel-map
    max-let-depth
    body)
  #:extra-constructor-name make-lam
  #:prefab)
  name : (or/c symbol? vector?)
  flags : 
(listof (or/c 'preserves-marks 'is-method 'single-result
              'only-rest-arg-not-used 'sfs-clear-rest-args))
  num-params : exact-nonnegative-integer?
  param-types : (listof (or/c 'val 'ref 'flonum 'fixnum))
  rest? : boolean?
  closure-map : (vectorof exact-nonnegative-integer?)
  closure-types : (listof (or/c 'val/ref 'flonum))
  toplevel-map : (or/c #f (set/c exact-nonnegative-integer?))
  max-let-depth : exact-nonnegative-integer?
  body : (or/c expr? seq? any/c)
Represents a lambda form. The name field is a name for debugging purposes. The num-params field indicates the number of arguments accepted by the procedure, not counting a rest argument; the rest? field indicates whether extra arguments are accepted and collected into a “rest” variable. The param-types list contains num-params symbols indicating the type of each argumet, either 'val for a normal argument, 'ref for a boxed argument (representing a mutable local variable), or 'flonum for a flonum argument.

The closure-map field is a vector of stack positions that are captured when evaluating the lambda form to create a closure. The closure-types field provides a corresponding list of types, but no distinction is made between normal values and boxed values; also, this information is redundant, since it can be inferred by the bindings referenced though closure-map.

Which a closure captures top-level or module-level variables, they are represented in the closure by capturing a prefix (in the sense of prefix). The toplevel-map field indicates which top-level and lifted variables are actually used by the closure (so that variables in a prefix can be pruned by the run-time system if they become unused). A #f value indicates either that no prefix is captured or all variables in the prefix should be considered used. Otherwise, numbers in the set indicate which variables and lifted variables are used. Variables are numbered consecutively by position in the prefix starting from 0. Lifted variables are numbered immediately afterward—which means that, if the prefix contains any syntax objects, lifted-variable numbers are shifted down relative to a toplevel by the number of syntax object in the prefix plus one (which makes the toplevel-map set more compact).

When the function is called, the rest-argument list (if any) is pushed onto the stack, then the normal arguments in reverse order, then the closure-captured values in reverse order. Thus, when body is run, the first value on the stack is the first value captured by the closure-map array, and so on.

The max-let-depth field indicates the maximum stack depth created by body plus the arguments and closure-captured values pushed onto the stack. The body field is the expression for the closure’s body.

struct

(struct closure expr (code gen-id)
  #:extra-constructor-name make-closure
  #:prefab)
  code : lam?
  gen-id : symbol?
A lambda form with an empty closure, which is a procedure constant. The procedure constant can appear multiple times in the graph of expressions for bytecode, and the code field can be a cycle for a recursive constant procedure; the gen-id is different for each such constant.

struct

(struct case-lam expr (name clauses)
  #:extra-constructor-name make-case-lam
  #:prefab)
  name : (or/c symbol? vector?)
  clauses : (listof lam?)
Represents a case-lambda form as a combination of lambda forms that are tried (in order) based on the number of arguments given.

struct

(struct let-one expr (rhs body type unused?)
  #:extra-constructor-name make-let-one
  #:prefab)
  rhs : (or/c expr? seq? any/c)
  body : (or/c expr? seq? any/c)
  type : (or/c #f 'flonum 'fixnum)
  unused? : boolean?
Pushes an uninitialized slot onto the stack, evaluates rhs and puts its value into the slot, and then runs body. If type is not #f, then rhs must produce a value of the corresponding type, and the slot must be accessed by localrefs that expect the type. If unused? is #t, then the slot must not be used, and the value of rhs is not actually pushed onto the stack (but rhs is constrained to produce a single value).

After rhs is evaluated, the stack is restored to its depth from before evaluating rhs. Note that the new slot is created before evaluating rhs.

struct

(struct let-void expr (count boxes? body)
  #:extra-constructor-name make-let-void
  #:prefab)
  count : exact-nonnegative-integer?
  boxes? : boolean?
  body : (or/c expr? seq? any/c)
Pushes count uninitialized slots onto the stack and then runs body. If boxes? is #t, then the slots are filled with boxes that contain #<undefined>.

struct

(struct install-value expr (count pos boxes? rhs body)
  #:extra-constructor-name make-install-value
  #:prefab)
  count : exact-nonnegative-integer?
  pos : exact-nonnegative-integer?
  boxes? : boolean?
  rhs : (or/c expr? seq? any/c)
  body : (or/c expr? seq? any/c)
Runs rhs to obtain count results, and installs them into existing slots on the stack in order, skipping the first pos stack positions. If boxes? is #t, then the values are put into existing boxes in the stack slots.

After rhs is evaluated, the stack is restored to its depth from before evaluating rhs.

struct

(struct let-rec expr (procs body)
  #:extra-constructor-name make-let-rec
  #:prefab)
  procs : (listof lam?)
  body : (or/c expr? seq? any/c)
Represents a letrec form with lambda bindings. It allocates a closure shell for each lambda form in procs, installs each onto the stack in previously allocated slots in reverse order (so that the closure shell for the last element of procs is installed at stack position 0), fills out each shell’s closure (where each closure normally references some other just-created closures, which is possible because the shells have been installed on the stack), and then evaluates body.

struct

(struct boxenv expr (pos body)
  #:extra-constructor-name make-boxenv
  #:prefab)
  pos : exact-nonnegative-integer?
  body : (or/c expr? seq? any/c)
Skips pos elements of the stack, setting the slot afterward to a new box containing the slot’s old value, and then runs body. This form appears when a lambda argument is mutated using set! within its body; calling the function initially pushes the value directly on the stack, and this form boxes the value so that it can be mutated later.

struct

(struct localref expr (unbox? pos clear? other-clears? type)
  #:extra-constructor-name make-localref
  #:prefab)
  unbox? : boolean?
  pos : exact-nonnegative-integer?
  clear? : boolean?
  other-clears? : boolean?
  type : (or/c #f 'flonum 'fixnum)
Represents a local-variable reference; it accesses the value in the stack slot after the first pos slots. If unbox? is #t, the stack slot contains a box, and a value is extracted from the box. If clear? is #t, then after the value is obtained, the stack slot is cleared (to avoid retaining a reference that can prevent reclamation of the value as garbage). If other-clears? is #t, then some later reference to the same stack slot may clear after reading. If type is not #f, the slot is known to hold a specific type of value.

struct

(struct toplevel expr (depth pos const? ready?)
  #:extra-constructor-name make-toplevel
  #:prefab)
  depth : exact-nonnegative-integer?
  pos : exact-nonnegative-integer?
  const? : boolean?
  ready? : boolean?
Represents a reference to a top-level or imported variable via the prefix array. The depth field indicates the number of stack slots to skip to reach the prefix array, and pos is the offset into the array.

When the toplevel is an expression, if both const? and ready? are #t, then the variable definitely will be defined, its value stays constant, and the constant is effectively the same for every module instantiation. If only const? is #t, then the value is constant, but it may vary across instantiations. If only ready? is #t, then the variable definitely will be defined, but its value may change. If const? and ready? are both #f, then a check is needed to determine whether the variable is defined.

When the toplevel is the right-hand side for def-values, then const? is #f. If ready? is #t, the variable is marked as immutable after it is defined.

struct

(struct topsyntax expr (depth pos midpt)
  #:extra-constructor-name make-topsyntax
  #:prefab)
  depth : exact-nonnegative-integer?
  pos : exact-nonnegative-integer?
  midpt : exact-nonnegative-integer?
Represents a reference to a quoted syntax object via the prefix array. The depth field indicates the number of stack slots to skip to reach the prefix array, and pos is the offset into the array. The midpt value is used internally for lazy calculation of syntax information.

struct

(struct application expr (rator rands)
  #:extra-constructor-name make-application
  #:prefab)
  rator : (or/c expr? seq? any/c)
  rands : (listof (or/c expr? seq? any/c))
Represents a function call. The rator field is the expression for the function, and rands are the argument expressions. Before any of the expressions are evaluated, (length rands) uninitialized stack slots are created (to be used as temporary space).

struct

(struct branch expr (test then else)
  #:extra-constructor-name make-branch
  #:prefab)
  test : (or/c expr? seq? any/c)
  then : (or/c expr? seq? any/c)
  else : (or/c expr? seq? any/c)
Represents an if form.

After test is evaluated, the stack is restored to its depth from before evaluating test.

struct

(struct with-cont-mark expr (key val body)
  #:extra-constructor-name make-with-cont-mark
  #:prefab)
  key : (or/c expr? seq? any/c)
  val : (or/c expr? seq? any/c)
  body : (or/c expr? seq? any/c)
Represents a with-continuation-mark expression.

After each of key and val is evaluated, the stack is restored to its depth from before evaluating key or val.

struct

(struct beg0 expr (seq)
  #:extra-constructor-name make-beg0
  #:prefab)
  seq : (listof (or/c expr? seq? any/c))
Represents a begin0 expression.

After each expression in seq is evaluated, the stack is restored to its depth from before evaluating the expression.

struct

(struct varref expr (toplevel dummy)
  #:extra-constructor-name make-varref
  #:prefab)
  toplevel : (or/c toplevel? #t)
  dummy : (or/c toplevel? #f)
Represents a #%variable-reference form. The toplevel field is #t if the original reference was to a constant local binding. The dummy field accesses a variable bucket that strongly references its namespace (as opposed to a normal variable bucket, which only weakly references its namespace); it can be #f.

struct

(struct assign expr (id rhs undef-ok?)
  #:extra-constructor-name make-assign
  #:prefab)
  id : toplevel?
  rhs : (or/c expr? seq? any/c)
  undef-ok? : boolean?
Represents a set! expression that assigns to a top-level or module-level variable. (Assignments to local variables are represented by install-value expressions.)

After rhs is evaluated, the stack is restored to its depth from before evaluating rhs.

struct

(struct apply-values expr (proc args-expr)
  #:extra-constructor-name make-apply-values
  #:prefab)
  proc : (or/c expr? seq? any/c)
  args-expr : (or/c expr? seq? any/c)
Represents (call-with-values (lambda () args-expr) proc), which is handled specially by the run-time system.

struct

(struct primval expr (id)
  #:extra-constructor-name make-primval
  #:prefab)
  id : exact-nonnegative-integer?
Represents a direct reference to a variable imported from the run-time kernel.

10.4.4 Syntax Objects

struct

(struct wrapped zo (datum wraps tamper-status)
  #:extra-constructor-name make-wrapped
  #:prefab)
  datum : any/c
  wraps : (listof wrap?)
  tamper-status : (or/c 'clean 'armed 'tainted)
Represents a syntax object, where wraps contain the lexical information and tamper-status is taint information. When the datum part is itself compound, its pieces are wrapped, too.

struct

(struct wrap zo ()
  #:extra-constructor-name make-wrap
  #:prefab)
A supertype for lexical-information elements.

struct

(struct top-level-rename wrap (flag)
  #:extra-constructor-name make-top-level-rename
  #:prefab)
  flag : boolean?
A top-level renaming.

struct

(struct mark-barrier wrap (value)
  #:extra-constructor-name make-mark-barrier
  #:prefab)
  value : symbol?
A mark barrier.

struct

(struct free-id-info zo (path0
    symbol0
    path1
    symbol1
    phase0
    phase1
    phase2
    use-current-inspector?)
  #:extra-constructor-name make-free-id-info
  #:prefab)
  path0 : module-path-index?
  symbol0 : symbol?
  path1 : module-path-index?
  symbol1 : symbol?
  phase0 : (or/c exact-integer? #f)
  phase1 : (or/c exact-integer? #f)
  phase2 : (or/c exact-integer? #f)
  use-current-inspector? : boolean?
Information about a free identifier.

struct

(struct lexical-rename wrap (has-free-id-info? bool2 alist)
  #:extra-constructor-name make-lexical-rename
  #:prefab)
  has-free-id-info? : boolean?
  bool2 : boolean?
  alist : 
(listof
 (cons/c symbol?
         (or/c symbol?
               (cons/c symbol?
                       (or/c (cons/c symbol? (or/c symbol? #f))
                             free-id-info?)))))
A local-binding mapping from symbols to binding-set names.

struct

(struct phase-shift wrap (amt src dest cancel-id)
  #:extra-constructor-name make-phase-shift
  #:prefab)
  amt : (or/c exact-integer? #f)
  src : module-path-index?
  dest : module-path-index?
  cancel-id : (or/c exact-integer? #f)
Shifts module bindings later in the wrap set.

struct

(struct module-rename wrap (phase
    kind
    set-id
    unmarshals
    renames
    mark-renames
    plus-kern?)
  #:extra-constructor-name make-module-rename
  #:prefab)
  phase : exact-integer?
  kind : (or/c 'marked 'normal)
  set-id : any/c
  unmarshals : (listof make-all-from-module?)
  renames : (listof module-binding?)
  mark-renames : any/c
  plus-kern? : boolean?
Represents a set of module and import bindings.

struct

(struct all-from-module zo (path
    phase
    src-phase
    exceptions
    prefix
    context)
  #:extra-constructor-name make-all-from-module
  #:prefab)
  path : module-path-index?
  phase : (or/c exact-integer? #f)
  src-phase : (or/c exact-integer? #f)
  exceptions : (listof symbol?)
  prefix : (or/c symbol? #f)
  context : 
(or/c (listof exact-integer?)
      (vector/c (listof exact-integer?) any/c)
      #f)
Represents a set of simple imports from one module within a module-rename.

struct

(struct module-binding zo ()
  #:extra-constructor-name make-module-binding
  #:prefab)
A supertype for module bindings.

struct

(struct simple-module-binding module-binding (path)
  #:extra-constructor-name make-simple-module-binding
  #:prefab)
  path : module-path-index?
Represents a single identifier import within a module-rename.

struct

(struct phased-module-binding module-binding (path
    phase
    export-name
    nominal-path
    nominal-export-name)
  #:extra-constructor-name make-phased-module-binding
  #:prefab)
  path : module-path-index?
  phase : exact-integer?
  export-name : any/c
  nominal-path : nominal-path?
  nominal-export-name : any/c
Represents a single identifier import within a module-rename.

struct

(struct exported-nominal-module-binding module-binding (path
    export-name
    nominal-path
    nominal-export-name)
  #:extra-constructor-name
  make-exported-nominal-module-binding
  #:prefab)
  path : module-path-index?
  export-name : any/c
  nominal-path : nominal-path?
  nominal-export-name : any/c
Represents a single identifier import within a module-rename.

struct

(struct nominal-module-binding module-binding (path nominal-path)
  #:extra-constructor-name make-nominal-module-binding
  #:prefab)
  path : module-path-index?
  nominal-path : nominal-path?
Represents a single identifier import within a module-rename.

struct

(struct exported-module-binding module-binding (path export-name)
  #:extra-constructor-name make-exported-module-binding
  #:prefab)
  path : module-path-index?
  export-name : any/c
Represents a single identifier import within a module-rename.

struct

(struct nominal-path zo ()
  #:extra-constructor-name make-nominal-path
  #:prefab)
A supertype for nominal paths.

struct

(struct simple-nominal-path nominal-path (value)
  #:extra-constructor-name make-simple-nominal-path
  #:prefab)
  value : module-path-index?
Represents a simple nominal path.

struct

(struct imported-nominal-path nominal-path (value import-phase)
  #:extra-constructor-name make-imported-nominal-path
  #:prefab)
  value : module-path-index?
  import-phase : exact-integer?
Represents an imported nominal path.

struct

(struct phased-nominal-path nominal-path (value import-phase phase)
  #:extra-constructor-name make-phased-nominal-path
  #:prefab)
  value : module-path-index?
  import-phase : (or/c false/c exact-integer?)
  phase : exact-integer?
Represents a phased nominal path.