#
Chapter 11
`compile.ss`: Compiling Files

`(compile-file``` `src``` [`dest filter`]`)` P R O C E D U R E

Compiles the Scheme file `src` and saves the compiled code to `dest`. If `dest` is not specified, a filename is constructed by taking `src`'s directory path, adding a `compiled` subdirectory, and then adding `src`'s filename with its suffix replaced by `.zo`. Also, if `dest` is not provided and the `compiled` subdirectory does not already exist, the subdirectory is created. If the `filter` procedure is provided, it is applied to each source expression and the result is compiled (otherwise, the identity function is used as the filter).

The `compile-file` function is designed for compiling modules files; each expression in `src` is compiled independently. If `src` does not contain a single `module` expression, then earlier expressions can affect the compilation of later expressions when `src` is loaded directly. An appropriate `filter` can make compilation behave like evaluation, but the problem is also solved (as much as possible) by the `compile-zos` function provided by the `compiler` collection's `compiler.ss` module.