CMLCOMPILE


(COMPILE-FILE FILENAME &KEY OUTPUT-FILE SAVE-EXPRS COMPILER-OUTPUT PROCESS-ENTIRE-FILE LAP REDEFINE)

compiles FILENAME. Reads expressions from FILENAME, compiles them, and writes the compiled version onto an output file which defaults to the same name (and directory) of FILENAME.

Unlike TCOMPL, the compiled versions of expressions on FILENAME are copied to the destination file in the same order they appear on the source file. In addition, it is possible to specify alternative compile-methods for new kinds of forms, by giving them a COMPILE.FILE.EXPRESSION property.

Any declarations, macros, constants, etc. encountered during processing of the file are "undone" on completion.

Options include:

COMPILER-OUTPUT stream
		all compiler warning messages are printed on stream
		defaults to T. (This is the same as COUTFILE.)

LAP	     if T, intermediate compiler code is printed
		on the COMPILER-OUTPUT file. Defaults
		to NIL.

REDEFINE
	if T, functions will be redefined as they are compiled
	default is NIL.
	Note that the "redefinition" happens all at once at 
	the end of compilation, rather than as the file is
	being processed.


SAVE-EXPRS 
		if NIL, when redefining, the old expr definitions
		will get thrown away. Defaults to T.

COMPILED-FILE filename
		Normally, the compiled code will get put on
		a file of the same name (and directory)
		as the source FILENAME, but with extension
		set to COMPILE.EXT.

		If this argument is supplied, its used as the
		name of the output file instead.


Listing? ST is the same as :REDEFINE T. Listing? F is the same as the default. Listing? STF is the same as (REDEFINE: T :SAVE-EXPRS T).

Adding new compile "methods":

COMPILE-FILE looks at the CAR of each expression on the file, and looks for a COMPILE-FILE-EXPRESSION property. If it finds one, it applies the value to arguments (EXPRESSION OUTPUTFILE RDTBL). The default COMPILE.FILE.EXPRESSION is PRINT, i.e., to copy the input file to the output compiled file.

DECLARE: (and an attempt to implement EVAL.WHEN) are handled specially; the system comes with a COMPILE-FILE-EXPRESSION for DEFINEQ (to compile the code) and * (to ignore the comments).

(this is primarily inspired by desire to handle DEFUNs on files directly for CommonLoops.)
------
Incompatibilities with BCOMPL, BRECOMPILE, TCOMPL, RECOMPILE (which will remain):

Block compilation is not supported. No plans offhand. No RECOMPILE-FILE (yet, but plans).

Files that put their compiler declarations (macros etc) at the end will have to be rearranged. I'm hoping to have a MAKEFILE option do that.