`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?
Afficher les réponses par date
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@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@iro.umontreal.ca https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list