[racket] getting some weird toplevel values from zo-parse

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Tue May 24 14:36:15 EDT 2011

>> which appear to index into offset 83 and 82 of the prefix.  However,
>> the prefix is only supposed to have space for 7 num-lifts, plus 68
>> toplevels, plus 1 more bucket to hold syntax.
>
> No, there's a bucket for each syntax object (plus the one bucket for
> having any syntax objects at all), which is another 8 buckets.

Ok, I'm definitely confused then.  Here's what's in zo-parse's documentation:

    http://docs.racket-lang.org/raco/decompile.html#(def._((lib._compiler/zo-parse..rkt)._prefix))

    """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 a bucket for another array if stxs is
non-empty, then num-lifts extra buckets for lifted local
procedures."""


The documentation makes it sound like the number of buckets is:

    (+ number-of-toplevels
        (if (> number-of-syntaxes 0) 1 0)
        number-of-lifts)

But if I understand you correctly, you're saying that it really should be:

    (+ number-of-toplevels
        number-of-syntaxes
        (if (> number-of-syntaxes 0) 1 0)
        number-of-lifts)


And that the layout should be toplevels, followed by syntax buckets,
followed by lift buckets.  Is that right?



Posted on the users mailing list.