[racket] top-level-rename
The program below produce bytecodes for the program that returns a
syntax-object representing 42.
The syntax-object looks like this:
(#s((stx zo 0)
#s((wrapped zo 0)
42
(#s((top-level-rename wrap 0 zo 0) #f)
#s((top-level-rename wrap 0 zo 0) #f)
#s((top-level-rename wrap 0 zo 0) #t)
#s((phase-shift wrap 0 zo 0) 0 #f #f #f))
clean))))
Two questions:
1) Why three top-level-renames and not just one?
2) What is the meaning of the boolean flag?
/Jens Axel
#lang racket
(require compiler/zo-structs compiler/zo-parse)
(define (bytecode->zo bytecode)
(zo-parse
(open-input-bytes
(with-output-to-bytes
(λ () (write bytecode))))))
(define (stx->zo x)
(parameterize ([current-namespace (make-base-empty-namespace)])
(namespace-require 'racket/base)
(bytecode->zo (compile x))))
(stx->zo '(syntax 42))