pprint-coalton-codegen pretty-prints the Common Lisp code generated by coalton-codegen to *standard-output*.
Syntax
(pprint-coalton-codegen
⟨toplevel-form⟩*)
Semantics
pprint-coalton-codegenaccepts the same top-level forms ascoalton-toplevel.- It compiles the forms via
coalton-codegen(with host type declarations omitted) and pretty-prints the resulting Common Lisp(progn ...)form to*standard-output*. - Before printing, it creates a temporary package that uses
#:cland imports all symbols accessible in the current*package*, so user and Coalton symbols print cleanly without redundant package prefixes, and deletes the temporary package viacl:unwind-protect. - Returns zero values
(cl:values).
Examples
;; Replace `coalton-toplevel` with `pprint-coalton-codegen` to inspect generated Lisp
(pprint-coalton-codegen
(declare sum-upto (UFix -> UFix))
(define (sum-upto n)
(for ((i 0 (+ i 1))
(acc 0 (+ acc i)))
:returns acc
:while (< i n))))
Other notes
- Use
pprint-coalton-codegen-typeswhen you also want to inspect the emitted Common Lisp(declare (type ...))and(the (values ...) ...)annotations. - See Debugging and Performance and Optimization.