Expand unnecessary abbreviations
[clqr.git] / clqr-compiler.tex
blobc9709a1c54a51b3026f7feea337eb22970b71718
1 % Copyright (C) 2008, 2009, 2010, 2011, 2012 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{Compiler}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \subsection{Predicates}
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 \begin{LIST}{1cm}
20 \IT{(\FU*{SPECIAL-OPERATOR-P} \VAR{foo})}
22 \retval{\T} if \VAR{foo} is a special operator.
25 \IT{(\FU*{COMPILED-FUNCTION-P} \VAR{foo})}
27 \retval{\T} if \VAR{foo} is of type \kwd{compiled-function}.
30 \end{LIST}
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 \subsection{Compilation}
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 \begin{LIST}{1cm}
39 \IT{(\FU*{COMPILE}
40 \xorGOO{\NIL\VAR{ definition}\\
41 \xorGOO{\VAR{name}\\
42 (\kwd{setf } \VAR{name})}{\}}\text{ }\Op{\VAR{definition}}}{\}})}
44 Return \retval{compiled function} or replace \retval{\VAR{name}}'s
45 function definition with the compiled function. Return \retvalii{\T} in case
46 of warnings or errors, and \retvaliii{\T} in case of warnings
47 or errors excluding style warnings.
50 \IT{(\FU*{COMPILE-FILE} \VAR{file}
51 \orGOO{\kwd{:output-file}\VAR{ out-path}\\
52 \kwd{:verbose} \VAR{ bool}\DF{\V{\A compile-verbose\A}}\\
53 \kwd{:print}\VAR{ bool}\DF{\V{\A compile-print\A}}\\
54 \kwd{:external-format} \VAR{
55 file-format}\DF{\kwd{:default}}}{\}})}
57 Write compiled contents of \VAR{file} to \VAR{out-path}.
58 Return \retval{true output path} or \retval{\NIL}, \retvalii{\T}
59 in case of warnings or errors, \retvaliii{\T} in case of warnings
60 or errors excluding style warnings.
63 \IT{(\FU*{COMPILE-FILE-PATHNAME} \VAR{file} \Op{\kwd{:output-file}
64 \VAR{path}} \Op{\VAR{other-keyargs}})}
66 \retval{Pathname} \FU{COMPILE-FILE} writes to if invoked with the
67 same arguments.
70 \IT{(\FU*{LOAD} \VAR{path}
71 \orGOO{\kwd{:verbose} \VAR{ bool}\DF{\V{\A load-verbose\A}}\\
72 \kwd{:print} \VAR{ bool}\DF{\V{\A load-print\A}}\\
73 \kwd{:if-does-not-exist} \VAR{ bool}\DF{\T}\\
74 \kwd{:external-format} \VAR{
75 file-format}\DF{\kwd{:default}}}{\}})}
77 Load source file or compiled file into Lisp environment. Return
78 \retval{\T} if successful.
81 \IT{\arrGOO{\V{\A compile-file}\\
82 \V{\A load}}{\}}\kwd{-}%
83 \xorGOO{\kwd{pathname\A}\DF{\NIL}\\
84 \kwd{truename\A}\DF{\NIL}}{.}}
85 {\index{*COMPILE-FILE-PATHNAME*@\A COMPILE-FILE-PATHNAME\A}\index{*COMPILE-FILE-TRUENAME*@\A COMPILE-FILE-TRUENAME\A}\index{*LOAD-PATHNAME*@\A LOAD-PATHNAME\A}\index{*LOAD-TRUENAME*@\A LOAD-TRUENAME\A}
86 Input file used by \FU{compile-file}/by \FU{load}.
89 \IT{\arrGOO{\V{\A compile}\\
90 \V{\A load}}{\}}\kwd{-}%
91 \xorGOO{\kwd{print\A}\\
92 \kwd{verbose\A}}{.}}
93 {\index{*COMPILE-PRINT*@\A COMPILE-PRINT\A}\index{*COMPILE-VERBOSE*@\A COMPILE-VERBOSE\A}\index{*LOAD-PRINT*@\A LOAD-PRINT\A}\index{*LOAD-VERBOSE*@\A LOAD-VERBOSE\A}
94 Defaults used by \FU{compile-file}/by \FU{load}.
97 \IT{(\SO*{EVAL-WHEN} (%
98 \orGOO{\Goo{\kwd{:compile-toplevel}\XOR\kwd{compile}}\\
99 \Goo{\kwd{:load-toplevel}\XOR\kwd{load}}\\
100 \Goo{\kwd{:execute}\XOR\kwd{eval}}}{\}}) \PROGN{\VAR{form}})}
102 Return \retval{values of \VAR{form}s} if
103 \SO{EVAL-WHEN} is in the top-level of a file being compiled, in the
104 top-level of a compiled file being loaded, or anywhere,
105 respectively. Return \retval{\NIL} if \VAR{form}s are not
106 evaluated. (\kwd{compile}, \kwd{load} and \kwd{eval} deprecated.)
109 \IT{(\SO*{LOCALLY} \OPn{(\kwd{declare} \OPn{\NEV{\VAR{decl}}})}
110 \PROGN{\VAR{form}})}
112 Evaluate \VAR{form}s in a lexical environment with declarations
113 \VAR{decl} in effect. Return \retval{values of \VAR{form}s}.
116 \IT{(\MC*{WITH-COMPILATION-UNIT} (\Op{\kwd{:override}
117 \VAR{bool}\DF{\NIL}}) \PROGN{\VAR{form}})}
119 Return \retval{values of \VAR{form}s}. Warnings deferred by the
120 compiler until end of compilation are deferred until the end of
121 evaluation of \VAR{form}s.
124 \IT{(\SO*{LOAD-TIME-VALUE} \VAR{form}
125 \Op{\NEV{\VAR{read-only}}\DF{\NIL}})}
127 Evaluate \VAR{form} at compile time and treat \retval{its value} as
128 literal at run time.
131 \IT{(\SO*{QUOTE} \NEV{\VAR{foo}})}
133 Return \retval{unevaluated \VAR{foo}}.
136 \IT{(\GFU*{MAKE-LOAD-FORM} \VAR{foo} \Op{\VAR{environment}})}
138 Its methods are to return a \retval{creation form} which on
139 evaluation at \FU{load} time returns an object equivalent to
140 \VAR{foo}, and an optional \retvalii{initialization form} which on
141 evaluation performs some initialization of the object.
144 \IT{(\FU*{MAKE-LOAD-FORM-SAVING-SLOTS} \VAR{foo}
145 \orGOO{\kwd{:slot-names} \VAR{ slots}\DF{all local slots}\\
146 \kwd{:environment} \VAR{ environment}}{\}})}
148 Return a \retval{creation form} and an \retvalii{initialization
149 form} which on evaluation construct an object equivalent to
150 \VAR{foo} with \VAR{slots} initialized with the corresponding values
151 from \VAR{foo}.
154 \IT{\arrGOO{(\FU*{MACRO-FUNCTION} \VAR{ symbol }
155 \Op{\VAR{environment}})\\
156 (\FU*{COMPILER-MACRO-FUNCTION}\text{ }
157 \xorGOO{\VAR{name}\\
158 (\kwd{setf } \VAR{name})}{\}}\text{ }
159 \Op{\VAR{environment}})}{.}}
161 Return specified \retval{macro function}, or \retval{compiler mac\-ro
162 func\-tion}, respectively, if any. Return \retval{\NIL}
163 otherwise. \kwd{setf}able.
166 \IT{(\FU*{EVAL} \VAR{arg})}
168 Return \retval{values of value of \VAR{arg}} evaluated in global environment.
171 \end{LIST}
174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
175 \subsection[REPL~\&~Debug]{REPL and Debugging}
176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
178 \begin{LIST}{1cm}
180 \IT{\arrGOO{\V*{+}\XOR\V*{++}\XOR\V*{+++}\\[1pt]
181 \V{\A}\text{ }\XOR\text{ }\V{\A\A}\text{ }\XOR\text{ }\V{\A\A\A}\\[1pt]
182 \V*{/}\text{ }\XOR\text{ }\V*{//}\text{ }\XOR\text{ }\V*{///}}{.}}
183 {\index{*@\A}\index{**@\A\A}\index{***@\A\A\A}
184 Last, penultimate, or antepenultimate \retval{form} evaluated in the REPL, or
185 their respective \retval{primary value}, or a \retval{list} of their respective
186 values.
189 \IT{\V*{--}}
191 \retval{Form} currently being evaluated by the REPL.
194 \IT{(\FU*{APROPOS} \VAR{string} \Op{\VAR{package}\DF{\NIL}})}
196 Print interned symbols containing \VAR{string}.
199 \IT{(\FU*{APROPOS-LIST} \VAR{string} \Op{\VAR{package}\DF{\NIL}})}
201 \retval{List of interned symbols} containing \VAR{string}.
204 \IT{(\FU*{DRIBBLE} \Op{\VAR{path}})}
206 Save a record of interactive session to file at \VAR{path}. Without
207 \VAR{path}, close that file.
210 \IT{(\FU*{ED} \Op{\VAR{file-or-function}\DF{\NIL}})}
212 Invoke editor if possible.
215 \IT{(\xorGOO{\FU*{MACROEXPAND-1}\\
216 \FU*{MACROEXPAND}}{\}} \VAR{form} \Op{\VAR{environment}\DF{\NIL}})}
218 Return \retval{macro expansion}, once or entirely, respectively, of
219 \VAR{form} and \retvalii{\T} if \VAR{form} was a macro form.
220 Return \retval{\VAR{form}} and \retvalii{\NIL} otherwise.
223 \IT{\V{\A macroexpand-hook\A}}
224 {\index{*MACROEXPAND-HOOK*@\A MACROEXPAND-HOOK\A}
225 Function of arguments expansion function, macro form, and
226 environment called by \FU{macroexpand-1} to generate macro
227 expansions.
230 \IT{(\MC*{TRACE} \xorGOO{\VAR{function}\\
231 (\kwd{setf } \VAR{function})}{\}^{\!\!*}})}
233 Cause \VAR{function}s to be traced. With no arguments,
234 return \retval{list of traced functions}.
237 \IT{(\MC*{UNTRACE} \xorGOO{\VAR{function}\\
238 (\kwd{setf } \VAR{function})}{\}^{\!\!*}})}
240 Stop \VAR{function}s, or each currently traced function, from being
241 traced.
244 \IT{\V{\A trace-output\A}}
245 {\index{*TRACE-OUTPUT*@\A TRACE-OUTPUT\A}
246 Stream \MC{trace} and \MC{time} print their output on.
249 \IT{(\MC*{STEP} \VAR{form})}
251 Step through evaluation of \VAR{form}. Return \retval{values of
252 \VAR{form}}.
255 \IT{(\FU*{BREAK} \Op{\VAR{control} \OPn{\VAR{arg}}})}
257 Jump directly into debugger; return \retval{\NIL}.
258 See page \pageref{section:Format}, \FU{format}, for \VAR{control}
259 and \VAR{arg}s.
262 \IT{(\MC*{TIME} \VAR{form})}
264 Evaluate \VAR{form}s and print timing information to
265 \V{\A trace-output\A}. Return \retval{values of \VAR{form}}.
267 \IT{(\FU*{INSPECT} \VAR{foo})}
269 Interactively give information about \VAR{foo}.
272 \IT{(\FU*{DESCRIBE} \VAR{foo}
273 \Op{\DES{\VAR{stream}}\DF{\V{\A standard-output\A}}})}
275 Send information about \VAR{foo} to \VAR{stream}.
278 \IT{(\GFU*{DESCRIBE-OBJECT} \VAR{foo} \Op{\DES{\VAR{stream}}})}
280 Send information about \VAR{foo} to \VAR{stream}. Not to be
281 called by user.
284 \IT{(\FU*{DISASSEMBLE} \VAR{function})}
286 Send disassembled representation of \VAR{function} to
287 \V{\A standard-output\A}. Return \retval{\NIL}.
290 \end{LIST}
293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
294 \subsection{Declarations}
295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296 \begin{LIST}{1cm}
298 \IT{\arrGOO{(\FU*{PROCLAIM} \VAR{ decl})\\
299 (\MC*{DECLAIM } \OPn{\NEV{\VAR{decl}}})}{.}}
301 Globally make declaration(s) \VAR{decl}. \VAR{decl} can be:
302 \kwd{declaration},
303 \kwd{type},
304 \kwd{ftype},
305 \kwd{inline},
306 \kwd{notinline},
307 \kwd{optimize}, or
308 \kwd{special}.
309 See below.
312 \IT{(\kwd*{DECLARE} \OPn{\NEV{\VAR{decl}}})}
314 Inside certain forms, locally make declarations \OPn{\VAR{decl}}. \VAR{decl} can be:
315 \kwd{dynamic-extent},
316 \kwd{type},
317 \kwd{ftype},
318 \kwd{ignorable},
319 \kwd{ignore},
320 \kwd{inline},
321 \kwd{notinline},
322 \kwd{optimize}, or
323 \kwd{special}.
324 See below.
327 \begin{LIST}{.5cm}
329 \IT{(\kwd*{DECLARATION} \OPn{foo})}
331 Make \VAR{foo}s names of declarations.
334 \IT{(\kwd*{DYNAMIC-EXTENT} \OPn{\VAR{variable}} \OPn{(\kwd{function}
335 \VAR{function})})}
337 Declare lifetime of \VAR{variable}s and/or \VAR{function}s to end
338 when control leaves enclosing block.
342 \IT{\arrGOO{(\Op{\kwd*{TYPE}} \VAR{ type} \OPn{\VAR{ variable}})\\
343 (\kwd*{FTYPE} \VAR{ type} \OPn{\VAR{ function}})}{.}}
345 Declare \VAR{variable}s or \VAR{function}s to be of \VAR{type}.
348 \IT{(\xorGOO{\kwd*{IGNORABLE}\\
349 \kwd*{IGNORE}}{\}}
350 \xorGOO{%
351 \VAR{var}\\
352 (\kwd{function} \VAR{ function})}{\}^{\!\!*}})}
354 Suppress warnings about used/unused bindings.
357 \IT{\arrGOO{(\kwd*{INLINE} \OPn{\VAR{ function}})\\
358 (\kwd*{NOTINLINE} \OPn{\VAR{ function}})}{.}}
360 Tell compiler to integrate/not to integrate, respectively, called
361 \VAR{function}s into the calling routine.
364 \IT{(\kwd*{OPTIMIZE} \orGOO{%
365 \kwd*{COMPILATION-SPEED}\XOR(\kwd*{COMPILATION-SPEED}\VAR{ n}\DF{\LIT{3}})\\
366 \kwd*{DEBUG}\XOR(\kwd*{DEBUG}\VAR{ n}\DF{\LIT{3}})\\
367 \kwd*{SAFETY}\XOR(\kwd*{SAFETY}\VAR{ n}\DF{\LIT{3}})\\
368 \kwd*{SPACE}\XOR(\kwd*{SPACE}\VAR{ n}\DF{\LIT{3}})\\
369 \kwd*{SPEED}\XOR(\kwd*{SPEED}\VAR{ n}\DF{\LIT{3}})}{\}})}
371 Tell compiler how to optimize. $n=0$ means unimportant, $n=1$ is
372 neutral, $n=3$ means important.
375 \IT{(\kwd*{SPECIAL} \OPn{\VAR{var}})}
377 Declare \VAR{var}s to be dynamic.
380 \end{LIST}
381 \end{LIST}
386 % LocalWords: mac ro func tion
388 %%% Local Variables:
389 %%% mode: latex
390 %%% TeX-master: "clqr"
391 %%% End: