[gambit-list] Showing optimized code expansions
Marc Feeley
feeley at iro.umontreal.ca
Fri Jan 24 09:30:41 EST 2020
Yes the compile-file and compile-file-to-target procedures take an optional “expression” parameter that is used instead of reading the source file:
% gsc
Gambit v4.9.3
> (compile-file-to-target "foo" options: '(expansion) expression: '(square (read)))
Expansion:
(let ((temp.0 (read)))
(if ('#<procedure #2 ##eq?> square '#<procedure #3 square>)
(if ('#<procedure #4 ##fixnum?> temp.0)
(let ((temp.1 ('#<procedure #5 ##fxsquare?> temp.0)))
(if temp.1 temp.1 (square temp.0)))
(if ('#<procedure #6 ##flonum?> temp.0)
('#<procedure #7 ##flsquare> temp.0)
(square temp.0)))
(square temp.0)))
"/Users/feeley/foo.c"
The source file parameter is needed to generate the name of the output file.
Marc
> On Jan 22, 2020, at 9:12 AM, Lassi Kortela <lassi at lassi.io> wrote:
>
> `gsc -expansion foo.scm` is really nice. Is there a way to show the same expansion from within the `gsc` REPL by giving an S-expression?
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list
More information about the Gambit-list
mailing list