[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [plt-scheme] Annotative forms in expand-program?
It probably won't matter for Matt's problem, but for those who are
following this thread, there is one tidbit I forgot to mention in my
last post.
The syntax system will actually direct you to the source of the
`check-top-level-no-defined' and `check-boolean', so if you are writing
a compiler, you can query the syntax objects for the definition of
those functions.
Robby
At Sun, 9 Jun 2002 13:48:03 -0500 (EST), Matt Jadud wrote:
>
> I was thinking I was all set in using the expanded form of a program,
> and I'd gain magical compatibility with any program implemented in DrScheme.
>
> The program
>
> (define (fact n)
> (if (zero? n)
> 1
> (* n (fact (n (- n 1))))))
>
> Expands as follows under the language setting "Textual MzScheme":
>
> (define-values
> (fact)
> (lambda (n)
> (if (#%app (#%top zero?) n)
> (#%datum 1)
> (#%app (#%top *) n (#%app (#%top fact)
> (#%app (#%top -) n (#%datum 1)))))))
>
> Under the "Beginning Student" language, however, I get the following:
>
> (begin
> (#%app check-top-level-not-defined (quote define) (quote-syntax fact))
> (define-values (fact)
> (lambda (n)
> (if (#%app verify-boolean (#%app zero? n) (quote if))
> (#%datum 1)
> (#%app * n (#%app (#%top fact)
> (#%app - n (#%datum 1))))))))
>
> I had to fgrep through the collections directory to find, in the "private"
> subdirectory of the "lang" collection the string "check-top-level." These
> run-time extentions for use in Beginner Scheme show up in the expansion of the
> definitions window; if any language can introduce arbitrary code to be
> evaluated at run-time into the primitive language, how do I handle expressions
> defined in modules that have no meaning in the language of my compiler?
>
> I thought I had a handle on this, but perhaps I didn't; am I missing
> something very obvious?
>
> Thanks,
> Matt
>
> ________________________________________________________________________
> Matt Jadud http://www.cs.indiana.edu/~mjadud/
> Current Temperature Outside Lindley Hall 80.4 F / 26.9 C
> Canterbury Weather: High 60 F / 16 C, Low 50 F / 10 C, Light rain shower (Day)