1% BEGIN LICENSE BLOCK 2% Version: CMPL 1.1 3% 4% The contents of this file are subject to the Cisco-style Mozilla Public 5% License Version 1.1 (the "License"); you may not use this file except 6% in compliance with the License. You may obtain a copy of the License 7% at www.eclipse-clp.org/license. 8% 9% Software distributed under the License is distributed on an "AS IS" 10% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11% the License for the specific language governing rights and limitations 12% under the License. 13% 14% The Original Code is The ECLiPSe Constraint Logic Programming System. 15% The Initial Developer of the Original Code is Cisco Systems, Inc. 16% Portions created by the Initial Developer are 17% Copyright (C) 1994 - 2006 Cisco Systems, Inc. All Rights Reserved. 18% 19% Contributor(s): 20% 21% END LICENSE BLOCK 22% 23% @(#)umscompiler.tex 1.9 94/07/15 24% 25% \comment{@(\#)text1.mss 20.4 9/19/88} 26% 27% REL DATE BY DESCRIPTION 28% 3.0.17 10.10.91 Micha Meier Created the file 29% 6.0 2008 Joachim Schimpf Update for new compiler 30% 31%---------------------------------------------------------------------- 32\chapter{The Compiler} 33\label{chapcompiler} 34%HEVEA\cutdef[1]{section} 35%---------------------------------------------------------------------- 36 37%---------------------------------------------------------------------- 38\section{Summary} 39%---------------------------------------------------------------------- 40The {\eclipse} compiler compiles {\eclipse} source (or Prolog source in 41various dialects) into the instructions of an abstract machine, which 42are then executed by an emulator. 43 44Program source can be read in text form from files, console, 45strings and general input streams. Alternatively, it can be provided 46in the form of a data structure (list of clause terms). 47 48The smallest program unit the compiler can meaningfully process is a 49predicate. In practice it is best to compile modules as a whole, since 50this allows for better consistency checks. 51 52Usually, the generated code is immediately loaded into main memory and 53ready for execution. 54This method is the most convenient during program development. 55In addition, compiled code can be output to a file ({\eclipse} 56object format, or {\it eco}), from which it can later be loaded more quickly. 57 58Compiled code optionally contains debugging information, allowing a 59source-oriented trace of program execution. 60 61 62%---------------------------------------------------------------------- 63\section{Compiler Invocation} 64%---------------------------------------------------------------------- 65 66The compiler is usually invoked by calling one of the following built-in 67predicates: 68\begin{quote} 69\begin{description} 70\item[\biptxtref{compile(\pattern{Source})}{compile/1}{../bips/kernel/compiler/compile-1.html}] 71This is the standard compiler predicate. 72Source is usually a file name, other forms are detailed below. 73The contents of the file is compiled with the default compiler options. 74 75\item[\biptxtref{compile(\pattern{Source},~\pattern{Options})}{compile/2}{../bips/kernel/compiler/compile-2.html}] 76This is the standard compiler predicate. 77Source is usually a file name, other forms are detailed below. 78Options is a list of options to control the compilation process, see details 79below. 80 81\item[\txtbipref{[\pattern{File1},...,\pattern{FileN}]}{(.)/2}{../bips/kernel/compiler/D-2.html}] 82This predicate can be used as a shorthand for the 83\bipref{compile/1}{../bips/kernel/compiler/compile-1.html} 84predicate. 85It accepts a list of files, which can be source files or precompiled files. 86 87\item[\biptxtref{compile_stream(\pattern{Stream})}{compile_stream/1}{../bips/kernel/compiler/compile_stream-1.html}] 88This predicate compiles a given, open stream up to its end 89or to the \notation{end_of_file} clause. 90It can be used when the input file is already open, 91e.g., when the beginning of the file does not contain 92compiler input. 93 94\item[\biptxtref{compile_stream(\pattern{Stream},~\pattern{Options})}{compile_stream/2}{../bips/kernel/compiler/compile_stream-2.html}] 95Like compile_stream/1 but with options list. 96 97\item[\biptxtref{compile_term(\pattern{Clauses})}{compile_term/1}{../bips/kernel/compiler/compile_term-1.html}] 98This predicate is used to compile a given term, 99usually a list of clauses and directives. 100Unlike \bipref{assert/1}{../bips/kernel/dynamic/assert-1.html} it compiles 101a static procedure, 102and so it can be used to compile a procedure which is dynamically 103created and then used as a static one. 104 105\item[\biptxtref{compile_term(\pattern{Clauses},~\pattern{Options})}{compile_term/2}{../bips/kernel/compiler/compile_term-2.html}] 106Like \predspec{compile_term/2} but with options list. 107\end{description} 108\end{quote} 109 110When using a development environment like 111\index{tkeclipse} 112\index{Saros} 113TkEclipse or Saros, the compiler is usually invoked implicitly via 114menu options or buttons. 115 116%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 117\subsection{Source Files} 118%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 119 120Program source is usually contained in files. The recommended file name 121\index{extension (file name)}\index{suffix (file name)}\index{file name!extension} 122suffixes (extensions) are 123\begin{itemize} 124\item \notation{.ecl} for {\eclipse} specific source 125\item \notation{.pl} for Prolog source 126\end{itemize} 127To compile a source files solver.ecl, any of the following forms is 128acceptable: 129\begin{quote} 130\begin{verbatim} 131?- compile('solver.ecl'). 132?- compile("solver.ecl"). 133?- compile("/home/joe/solver.ecl"). 134?- compile("/home/joe/solver"). 135?- compile(solver). 136\end{verbatim} 137\end{quote} 138File names must be single quoted (atom) or double quoted (string) 139if they contain punctuation, blank space, or start with an upper case letter. 140The \notation{.ecl} extension can be omitted as long as no file without 141extension 142is present. A \notation{.pl} extension can be omitted as long as no file without 143extension and no file with \notation{.ecl} extension is present. The list of 144accepted suffixes and their precedence is given by the global flag 145\notationidx{prolog_suffix}, see 146\bipref{get_flag/3}{../bips/kernel/compiler/get_flag-3.html}. 147 148The following shorthands can be used, but note that the last two forms 149will load precompiled .eco files by preference, should they be present: 150\begin{quote} 151\begin{verbatim} 152?- ['solver.ecl']. 153?- ["solver.ecl"]. 154?- ["/home/joe/solver.ecl"]. 155?- ["/home/joe/solver"]. 156?- [solver]. 157\end{verbatim} 158\end{quote} 159 160If the source is given as \notation{library(\pattern{Name})}, the predicates 161looks for the file 162in the directories from the global flag \notation{library_path}. 163 164If File is the special atom 'user', the source will be taken from 165the current 'input' stream, i.e., will usually generate a prompt 166at which clauses can be typed in. In this case, input must be 167terminated either by typing \notation{CTRL-D} (on Unix), 168\notation{CTRL-Z} + \notation{RETURN} 169(on Windows), or with the single atom \notation{end_of_file}, followed by 170a fullstop (period). 171\begin{quote} 172\begin{verbatim} 173?- [user]. 174 main :- writeln(hello). 175^D 176tty compiled 72 bytes in 0.01 seconds 177Yes (0.01 cpu) 178?- main. 179hello 180Yes (0.00s cpu) 181\end{verbatim} 182\end{quote} 183 184If File is the special form stream(Stream), then the source is taken 185from the given stream (which must be already opened). The stream 186content is compiled until the end of stream (or the \notation{end_of_file} 187marker). 188Using this feature, any {\eclipse} stream (file, socket, tty, string, 189queue, pipe) can be used as the source for program text. 190 191 192%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 193\subsection{Main Compiler Options} 194%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 195 196The following compiler options affect the generated code: 197\begin{quote} 198\begin{description} 199\item[debug:] 200 This option (\notation{off}/\notation{on}) determines whether the resulting 201 code 202 contains 203 debugging information. If \notation{off}, subgoals of the compiled 204 predicates 205 will 206 not be visible to the debugger, the code will be significantly smaller, 207 and slightly faster. 208 The default value is taken from the global flag \notation{debug_compile}. 209 The setting can be changed via a pragma 210 (\notation{debug}/\notation{nodebug}) in the code. 211 212\item[opt_level:] 213 Currently the integer 0 or 1, with 1 the default. Setting this to 0 214 will disable certain compiler optimizations and usually reduce performance. 215 The setting can be changed via an \notation{opt_level(Level)} pragma in the 216 code. 217\end{description} 218\end{quote} 219The following options determine what is being done with the compilation result: 220\begin{quote} 221\begin{description} 222\item[load:] 223 Determines whether the generated code is immediately loaded into memory, 224 ready for execution. Values for the \notation{load} option are: 225 \begin{description} 226 \item[all] 227 (This is the default.) Load and replace code in memory, create/re-create 228 all modules, 229 interpret pragmas, and execute all directives and queries. 230 \item[none] 231 Do not load any code into memory, do not execute queries, 232 but interpret pragmas and execute directives. 233 Do not re-create modules, but create new ones and erase them 234 again after compilation. 235 \item[new] 236 Do not overwrite any code in memory, but load new predicates. 237 Do not execute queries, but interpret pragmas and execute directives. 238 Do not re-create modules, but create new ones and erase them 239 again after compilation. For existing modules, erase pragmas. 240 \end{description} 241 242\item[output:] 243 The abstract machine code which is the result of the compilation can 244 be output in various forms. Possible values are: 245 \begin{description} 246 \item[none] 247 (This is the default). 248 No output (but code may be loaded, see \notation{load} option). 249 \item[eco] 250 output compiled code in \about{eco} format to a file whose suffix is 251 \notation{.eco}. 252 This format can be loaded using \predspec{ensure_loaded/1} or the 253 compiler itself. 254 \item[eco(\pattern{File})] 255 output compiled code in \about{eco} format to \about{File}. 256 \item[asm] 257 output compiled code in \about{asm} format to a file whose suffix is 258 \notation{.asm}. 259 This format represents the code as WAM code that can be loaded back 260 into ECLiPSe using the assembler (\notation{lib(asm)}). 261 \item[asm(\pattern{File})] 262 output compiled code in \notation{asm} format to \about{File}. 263 \end{description} 264 265\item[outdir:] 266 Value is the destination directory for all output files. 267 The default is the empty string \notation{""}, meaning that all output files 268 go into the same directory as the corresponding input file. 269\end{description} 270\end{quote} 271For other options see 272\bipref{compile/2}{../bips/kernel/compiler/compile-2.html}. 273 274For example, to compile a program without debugging support directly into 275memory, use 276\begin{quote}\begin{verbatim} 277?- compile(myprogram, [debug:off]). 278\end{verbatim} 279\end{quote} 280The following command will create a precompiled file myprogram.eco from a 281source file called myprogram.ecl (or myprogram.pl): 282\begin{quote}\begin{verbatim} 283?- compile(myprogram, [output:eco]). 284\end{verbatim} 285\end{quote} 286 287 288%---------------------------------------------------------------------- 289\section{Source Structure} 290%---------------------------------------------------------------------- 291 292The compiler normally reads files from beginning to end, but the 293file end can also be simulated with a clause 294\begin{quote} 295\begin{verbatim} 296end_of_file. 297\end{verbatim} 298\end{quote} 299When reading from a terminal/console, the end of the input can be 300marked by \notation{CTRL-D} (in Unix-like systems) or 301\notation{CTRL-Z}+\notation{RETURN} on Windows. 302 303When reading program source, the compiler distinguishes 304{\it clauses}, {\it directives} and {\it file queries}. 305Directives are terms with main functor 306\predspec{:-/1} 307while file queries have the main functor 308\predspec{?-/1}. Everything else is a program clause 309(see Appendix~\ref{chapsyntax}). 310 311The differences between a directive and a file query are as follows: 312\begin{itemize} 313\item File queries are general goals, and are executed when the program 314 is loaded, i.e., when compiling with the load-option set to 315 \notation{all}, 316 or when loading a compiled file. When compiling without loading, 317 they are ignored. 318\item Directives can be general goals, in which case they are executed 319 while the program is being compiled, and also when a compiled 320 program is loaded. 321\item Some directives are not goals, but are interpreted by the compiler 322 (or other source processing tool), e.g., module-directives or 323 pragmas. These should not be combined with general goals in 324 the same directive. 325\end{itemize} 326Directives and file queries should succeed and should only have a single 327solution. No results are printed by the system, failure leads to a warning, 328and an error condition will cause compilation to abort. 329 330%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 331\subsection{Clauses and Predicates} 332%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 333 334All other input terms are interpreted as clauses to be compiled. 335A sequence of consecutive clauses whose heads have the same 336functor is interpreted as one predicate. Normally, all clauses for 337one predicate should be consecutive in the source. If this is not the 338case, the compiler issues a warning and ignores the new clauses. 339 340To change this behaviour, a 341\bipref{discontiguous/1}{../bips/kernel/compiler/discontiguous-1.html} 342declaration must be used. The clauses are then collected and compiled 343as a whole once the end of the source unit (file or module) has been reached. 344 345To add clauses for a predicate incrementally though several independent 346compiler invocations is only possible by declaring the corresponding 347predicate as \bipref{dynamic/1}{../bips/kernel/dynamic/dynamic-1.html}, 348see Chapter \ref{chapdynamic}. 349 350 351%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 352\subsection{Compilation and Modules} 353%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 354 355In the absence of module-directives 356(\bipref{module/1}{../bips/kernel/modules/module-1.html}, 357\bipref{module/3}{../bips/kernel/modules/module-3.html}) 358within the file, the 359file content is compiled into the module from which \predspec{compile/1,2} 360itself 361was called. This context module may be modified using the \notation{@/2} 362notation, 363i.e., \notation{compile(File, Options)@Module}. Existing static predicates will 364be redefined, and clauses for dynamic predicates appended to the 365existing ones (unless the 'load' option requests otherwise). 366 367If the compiled file contains module directives (\predspec{module/1,3}), these 368specify to which module(s) the subsequent code belongs. Module directives 369are effective from the point where they occur until the next module 370directive, or until the end of file. If a module directive refers 371to a module that already exists, this module is erased and redefined 372(unless the 'load' option requests otherwise). 373 374It is generally recommended to follow the \emph{one file -- one module} 375convention, and to make the base name of the file identical to the 376module name. In rare cases, it may make sense to have an auxiliary 377module in the same file as the main module. This is allowed, and 378every new module directive terminates the previous module. 379 380To spread the code for one module over several files, use a top-level 381file containing the module directive plus one or more include-directives 382(section \ref{secinclude}) for the component files. 383 384 385%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 386\subsection{Incrementality} 387%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 388 389When it encounters a 390\bipref{module/1}{../bips/kernel/modules/module-1.html} or 391\bipref{module/3}{../bips/kernel/modules/module-3.html} directive 392the compiler first erases previous contents of this module, 393if there was any, before starting to compile predicates 394into it. This means that in order to incrementally add predicates 395to a module, the module directive cannot be used 396because the previous contents of the module would be destroyed. 397Instead, the construct \notation{compile(File)@Module} must be used. 398 399 400 401 402%---------------------------------------------------------------------- 403\section{Directives} 404%---------------------------------------------------------------------- 405 406%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 407\subsection{Modules and Declarations} 408%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409 410The following is a list of the directives most commonly used in source files: 411\begin{quote} 412\begin{description} 413\item[\biptxtref{:- module(\pattern{Name}).}{module/1}{../bips/kernel/modules/module-1.html}] 414Beginning of a module. 415 416\item[\biptxtref{% 417:- module(\pattern{Name},~\pattern{Exports},~\pattern{Dialect}).}{module/3}{../bips/kernel/modules/module-3.html}] 418Beginning of a module in a given dialect. 419 420\item[\biptxtref{:- local \pattern{Specs}.}{local/1}{../bips/kernel/modules/local-1.html}] 421Declaration of local items, e.g., syntax settings, operators, global storage, 422etc. 423 424\item[\biptxtref{:- export \pattern{Specs}.}{export/1}{../bips/kernel/modules/export-1.html}] 425Declaration of exported items, e.g., predicates, syntax settings, operators, 426etc. 427 428\item[\biptxtref{:- reexport \pattern{Specs}.}{reexport/1}{../bips/kernel/modules/reexport-1.html}] 429Declaration of reexported items. 430 431\item[\biptxtref{:- import \pattern{Specs}.}{import/1}{../bips/kernel/modules/import-1.html}] 432Declaration of imported modules or predicates. 433 434\item[\biptxtref{:- use_module(\pattern{Mods}).}{use_module/1}{../bips/kernel/modules/use_module-1.html}] 435Loading and importing of modules or libraries. 436 437\item[\biptxtref{:- lib(\pattern{Libs}).}{lib/1}{../bips/kernel/compiler/lib-1.html}] 438Loading and importing of libraries. 439 440\item[\biptxtref{:- meta_attribute(\pattern{Name},~\pattern{Handlers})}{meta_attribute/2}{../bips/kernel/termmanip/meta_attribute-2.html}] 441Declare a variable attribute. 442 443\item[\biptxtref{:- comment(\pattern{Type},~\pattern{Info})}{comment/2}{../bips/kernel/directives/comment-2.html}] 444Structured program documentation. 445\end{description} 446\end{quote} 447 448 449%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450\subsection{Conditional Compilation} 451%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452 453The compiler and other source-processing tools recognise the conditional 454compilation directives 455\bipref{if/1}{../bips/kernel/directives/if-1.html}, 456\bipref{elif/1}{../bips/kernel/directives/elif-1.html}, 457\bipref{else/0}{../bips/kernel/directives/else-0.html} and 458\bipref{endif/0}{../bips/kernel/directives/endif-0.html}. 459The first two 460take a goal as their argument, and parts of the program source can be 461included or excluded depending of the satisfiability of that goal. 462For example, 463\begin{quote} 464\begin{verbatim} 465:- if(get_flag(hostarch, "i386_nt")). 466 ...Windows-specific code... 467:- elif( (get_flag(version_as_list,Version), Version @>= [6,0]) ). 468 ...code for version 6.0 and later... 469:- else. 470 ...alternative code... 471:- endif. 472\end{verbatim} 473\end{quote} 474Note however, that only complete clauses or directives can be 475conditionally included. 476 477 478%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 479\subsection{Include Directives} 480\label{secinclude} 481%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 482 483Generally, it is best to use the module system to structure {\eclipse} 484applications, and to use one module per file. The modules then refer 485to each other via \predspec{use_module/1}, \predspec{lib/1}, or 486\predspec{import/1} directives. 487In rare cases it can make sense to split a single module into several 488files, which can then be pulled together using the following include 489directives: 490 491\begin{quote} 492\begin{description} 493\item[\biptxtref{:- include(\pattern{Files}).}{include/1}{../bips/kernel/directives/include-1.html}] 494The contents of the given Files are treated as if they occurred in place of 495the include directive. Files is a single file name or a list of them. 496 497\item[\biptxtref{:- [\pattern{Files}].}{'.'/2}{../bips/kernel/compiler/D-2.html}] 498A synonym for the include/1 directive. Note that the semantics of this 499construct when used as a directive (include semantics) differs slightly 500from its use as a goal or query (compiler/loader invocation). 501\end{description} 502\end{quote} 503 504Included files can contain clauses, directives and queries, but should 505not contain \predspec{module/1,3} directives, since they would be interpreted as 506occurring within the including file, and the included module would 507not end at the end of the included file. 508 509 510%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 511\subsection{Compiler Pragmas} 512%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 513\index{pragma}\index{compiler!pragma} 514Compiler pragmas are compiler directives which instruct the compiler 515to emit a particular code type, overriding the options given to the compiler. 516Their syntax is similar to directives: 517\begin{quote} 518\predspec{:- pragma(\pattern{Option}).}\indextt{pragma/1} 519\end{quote} 520It is not possible to have several pragmas grouped together and separated 521by commas, every pragma must be specified separately. 522{\it Option} can be one of the following: 523\begin{quote} 524\begin{description} 525\item[debug] - generate code which can be inspected with the 526debugger. 527This overrides the global setting of the \notation{debug_compile} flag, 528and any debug-option given to the compiler. 529 530\item[nodebug] - generate optimized code with no debugger support. 531This overrides the global setting of the \notation{debug_compile} flag, 532and any debug-option given to the compiler. 533 534\item[expand] - do in-line expansion of built-ins 535like \bipref{is/2}{../bips/kernel/arithmetic/is-2.html} and user-defined 536inline predicates. 537This code can still be inspected with the debugger but the expanded 538subgoals look differently than in the normal debugged code, 539or their arguments cannot be seen. 540This pragma overrides the global setting of the \notation{goal_expansion} flag, 541and any expand-option given to the compiler. 542 543\item[noexpand] - inhibit the in-line goal expansion. 544This pragma overrides the global setting of the \notation{goal_expansion} flag, 545and any expand-option given to the compiler. 546 547\item[opt_level(\pattern{Level})] 548 - override the \notation{opt_level} option given to the 549 compiler. \about{Level} is an integer greater or equal to 0. A zero 550 setting disables all optional optimization. 551 552\item[skip] - set the \notation{skip} flag of all following 553predicates to \notation{on}. 554 555\item[noskip] - set the \notation{skip} flag of all following 556predicates to \notation{off}. 557 558\item[system] - set the \notation{type} flag of all following 559predicates to \notation{built_in}. 560Moreover, all following predicates will have unspecified 561\notation{source_file} and \notation{source_line} flags. 562 563\item[warnings] - enable compiler warnings, overriding any 564warnings-option given to the compiler. 565 566\item[nowarnings] - disable compiler warnings, overriding any 567warnings-option given to the compiler. 568 569\end{description} 570\end{quote} 571 572A pragma is active from its specification in the file 573until the file end or until it is disabled by another pragma. 574Recursive compilations or calls to other compiling predicates 575are not affected by the pragma. 576 577The pragmas are useful mainly for libraries and other programs 578that should be always compiled in a particular mode 579independently of the global flags or compiler option settings. 580 581 582%---------------------------------------------------------------------- 583\section{Precompiled (ECO) Files} 584%---------------------------------------------------------------------- 585 586%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 587\subsection{Making Precompiled Files} 588%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 589{\eclipse} source files can be compiled into {\eclipse} object files, 590\index{object code} 591for subsequent loading. These files have the \notation{.eco} suffix 592by default. 593This facility is mainly intended for module files. 594To create such a file, call the compiler with the 595appropriate output-option, e.g., 596\begin{quote} 597\begin{verbatim} 598?- compile(myprogram, [output:eco]). 599\end{verbatim} 600\end{quote} 601This creates a precompiled file myprogram.eco from a source file called 602\notation{myprogram.ecl} (or \notation{myprogram.pl}). If the source file 603contained 604include directives, the result will be a single object file containing 605the compiled code of all included files. 606In earlier releases of {\eclipse} this was done using the 607\bipref{fcompile/1}{../bips/lib/fcompile/fcompile-1.html} 608predicate from the fcompile library, 609which is still supported for compatibility. 610 611Loading of {\eclipse} object files is significantly faster than compilation 612from source. In {\eclipse} 6.0, {\eclipse} object files are text files 613containing a representation of the compiled abstract machine code, and 614can be used to deploy application code without revealing the source. 615The precompiled code is hardware and operating system independent. 616It may however not be portable between different versions of {\eclipse} 617if details of the abstract machine were modified between releases. 618 619The global flag 620\notationidx{eclipse_object_suffix} determines the 621file suffix used for {\eclipse} object files. 622 623 624\subsection{Restrictions} 625 626Currently, the compiler generates the auxiliary predicates for the do 627iterator using a module-wide counter to name the predicates. Unfortunately this 628means that if an object file with auxiliary predicates is loaded into a 629module that already has existing code that contains auxiliary predicates, 630naming conflict can occur and the old auxiliaries may be replaced. It is 631thus strongly recommended that object files should not be loaded into an 632existing module. This will only be a problem if the file does not contain 633any module declarations that redefine the module (i.e., 634\bipref{module/1}{../bips/kernel/modules/module-1.html}), 635as these redefinition will erase the old copy of 636the module. 637 638%The predicate generates the object code by first compiling the program and 639%then outputting the object code. Directives, which are executed in a normal 640%compilation process, will not be executed during the output of the object 641%code (but the directives themselves will be added to the object code so 642%that they will be executed when the code is loaded). This can lead to 643%differences between loading the object code and compiling the program if 644%the directive affects the compiled code during the compilation 645%(e.g., determining which files to load by a conditional in a 646%directive). 647 648%If macro transformation is defined (via 649%\bipref{macro/3}{../bips/kernel/syntax/macro-3.html} 650%declarations) in the module that is fcompiled, then 651%the ``protecting functor'' {\tt no_macro_expansion} 652%\index{no_macro_expansion/1} \index{macro!no_macro_expansion} (see 653%section~\ref{usingmacros}) should be used to prevent the macro definition 654%itself from being transformed when the definition is generated by 655%fcompile. For example: 656% 657%\begin{quote}\begin{verbatim} 658%:- local macro(no_macro_transformation(foo/1), trans_foo/2, []). 659%\end{verbatim}\end{quote} 660% 661%\noindent 662%the {\tt no_macro_transformation/1} wrapper prevents this instance of {\tt 663%foo/1} from being transformed when the directive is generated by fcompile. 664%Note that this is only needed if all terms are transformed, and not for 665%goals or clause transformation. 666 667One restriction does apply between platforms of different 668word sizes: integers which fit in the word size of one platform 669but not the other are represented differently internally in {\eclipse}. 670Specifically, integers which takes between 32 and 64 671bits to represent are treated as normal integers on a 64 bit machine, 672but as bignums (see section~\ref{intrep}) on 32 bit machines. This 673difference is normally invisible, but if 674such numbers occur as constants in the program code (i.e., their values appear 675textually), they can lead to different low-level compiled abstract code on 676the different platforms. Avoid using such constants if you want 677the object code to be portable across different word sizes (they can always 678be computed at run-time, e.g., writing \verb'2^34' instead of 679\notation{17179869184}). 680 681 682 683%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 684\subsection{Loading Precompiled Files} 685%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 686The following predicates either invoke the compiler or load 687precompiled\notation{.eco} files. 688If the source specification does not specify the file type, precompiled files 689are preferred if they can be found in the search path: 690 691\begin{quote} 692\begin{description} 693\item[\txtbipref{[\pattern{File1},...,\pattern{FileN}]}{(.)/2}{../bips/kernel/compiler/D-2.html}] 694This predicate can be used as a shorthand for the \predspec{compile} predicate, 695usually in the interactive toplevel. 696It accepts a list of files, which can be source files or precompiled files. 697 698\item[\biptxtref{ensure_loaded(\pattern{Files})}{ensure_loaded/1}{../bips/kernel/compiler/ensure_loaded-1.html}] 699This predicate compiles the specified file if it has not been compiled 700yet or if it has been modified since the last compilation. 701It can be used to load application code or system libraries. 702 703\item[\biptxtref{use_module(\pattern{Files})}{use_module/1}{../bips/kernel/modules/use_module-1.html}] 704A combination of \predspec{ensure_loaded/1} and \predspec{import/1}. 705 706\item[\biptxtref{lib(\pattern{Lib})}{lib/1}{../bips/kernel/compiler/lib-1.html}] 707This predicate is used to ensure that a specified library file is loaded. 708It is equivalent to \notation{ensure_loaded(library(\pattern{Lib}))}. 709If this library is not yet compiled or loaded, the system will look 710in all directories in the \notation{library_path} flag for a file with this 711name, 712which is either a source file or a precompiled file, and compile or load it. 713 714\item[\biptxtref{make}{make/0}{../bips/kernel/env/make-0.html}] 715This predicate recompiles or reloads all files that have been modified 716since their last compilation or loading. 717\end{description} 718\end{quote} 719 720To implement reloading/recompiling when needed, the system keeps track of 721when a particular source files was compiled or precompiled file was loaded 722into memory. This information can be accessed explicitly through 723\bipref{current_compiled_file/3}{../bips/kernel/compiler/current_compiled_file-3.html}. 724 725%\item[\biptxtref{assert(Clause)}{assert/1}{../bips/kernel/dynamic/assert-1.html}] 726%\index{assert/1} 727%This predicate compiles the given clause of a dynamic predicate. 728 729 730%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 731\subsection{Using the Compiler with a Makefile} 732%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 733 734To generate .eco file from source files, the compiler can be run from the 735command line using the -e option. 736To invoke it from a makefile, use the following suffix rule 737\begin{quote} 738\begin{verbatim} 739.SUFFIXES: $(SUFFIXES) .ecl .eco 740.ecl.eco: 741 eclipse -e "compile(\"$<\",[output:eco])" 742\end{verbatim} 743\end{quote} 744or a pattern rule for Gnu make: 745\begin{quote} 746\begin{verbatim} 747%.eco: %.ecl 748 eclipse -e "compile(\"$<\",[output:eco])" 749\end{verbatim} 750\end{quote} 751 752 753 754%---------------------------------------------------------------------- 755\section{Special Compiler Features} 756%---------------------------------------------------------------------- 757 758%---------------------------------------------------------------------- 759\subsection{Compiling Non-Textual Source} 760%---------------------------------------------------------------------- 761A characteristic feature of Prolog and {\eclipse} is, that programs can 762be represented as data structures in a straightforward way. 763The compiler therefore provides the 764\bipref{compile_term/1}{../bips/kernel/compiler/compile_term-1.html} and 765\bipref{compile_term/2}{../bips/kernel/compiler/compile_term-2.html} 766interface predicates, which allow one to compile a list of terms. The compiler 767interprets these as clauses, directives and queries, similarly to what happens 768when the program 769source is being read from a file. For program generators, it is therefore 770not necessary to create a textual representation of generated code - 771the data structures can be compiled directly. 772 773There are the following minor differences between compilation from 774textual sources and term compilation: 775\begin{itemize} 776\item Module directives are not supported - to compile code into a certain 777 module, use the construct compile_term(Clauses,Options)@Module, and use 778 \bipref{create_module/1}{../bips/kernel/modules/create_module-1.html} 779 to create modules beforehand if necessary. 780\item Include directives do not make sense and are not supported. 781\item No end-of-compilation events are raised---\predspec{compile_term/1} 782 behaves more 783 like the compilation of an included file in this respect. This implies 784 that discontiguous predicates are not supported. 785\end{itemize} 786 787A variant of \predspec{compile_term/2} is 788\bipref{compile_term_annotated/3}{../bips/kernel/compiler/compile_term_annotated-3.html} 789which takes source terms with source position annotations. 790This can be used when compiling auxiliary code within inlining/goal 791expansions transformations, without losing the source position information 792which is needed by the debugger. 793 794 795%---------------------------------------------------------------------- 796\subsection{Mode Declarations} 797%---------------------------------------------------------------------- 798\indextt{mode/1} 799\index{mode declaration} 800Mode declarations are a way for the user to give some additional 801information to the compiler, thus enabling it to do a better job. 802The {\eclipse} compiler makes use of the mode information mainly to 803improve indexing and to reduce code size. 804 805Mode declarations are optional. They specify the argument instantiation 806patterns that a predicate will be called with at runtime, for example: 807\begin{quote} 808\begin{verbatim} 809:- mode p(+), q(-), r(++, ?). 810\end{verbatim} 811\end{quote} 812The possible argument modes and their meaning are: 813 814\newlength{\firstColumn} 815\newlength{\secondColumn} 816\settowidth{\firstColumn}{\notation{++}} 817\setlength{\secondColumn}{\textwidth} 818\addtolength{\secondColumn}{-\firstColumn} 819\addtolength{\secondColumn}{-7.5em} 820\begin{quote} 821\begin{tabular}[t]{l@{\hspace{1em}}p{\secondColumn}} 822\notation{+} & the argument is instantiated, i.e., it is not a variable;\\ 823\notation{++} & the argument is ground;\\ 824\notation{-} & the argument is not instantiated, it must be a free variable 825 without any constraints, especially it must not occur in any 826 other argument and it cannot be a suspending variable;\\ 827\notation{?} & the mode is not known or it is neither of the above ones. 828\end{tabular} 829\end{quote} 830 831Note that, if the actual instantiation of a predicate call violates 832its mode declaration, the behaviour is undefined. 833Usually, an unexpected failure occurs in this case. 834 835%---------------------------------------------------------------------- 836\subsection{Inlining} 837%---------------------------------------------------------------------- 838\index{inlining} 839\index{goal expansion} 840To improve efficiency, calls to user-defined predicates can be 841preprocessed and transformed at compile time. The directive 842\bipref{inline/2}{../bips/kernel/compiler/inline-2.html}, e.g., 843\begin{quote} 844\begin{verbatim} 845:- inline(mypred/1, mytranspred/2). 846\end{verbatim} 847\end{quote} 848arranges for \predspec{mytranspred/2} to be invoked at compile time for each 849call to the predicate \predspec{mypred/1} before this call is being compiled. 850 851The transformation predicate receives the original call to \predspec{mypred/1} 852as its first argument, and is expected to return a replacement goal 853in its second argument. This replacement goal replaces the original 854call in the compiled code. Usually, the replacement goal would be 855semantically equivalent, but more efficient than the original goal. 856When the transformation predicate fails, the original goal is not 857replaced. 858 859Typically, a predicate would be defined together with the corresponding 860inlining transformation predicate, e.g., 861\begin{quote} 862\begin{verbatim} 863:- inline(double/2, trans_double/2). 864 865double(X, Y) :- 866 Y is 2*X. 867 868trans_double(double(X, Y), Y=Result) :- 869 not nonground(X), % if X already known at compile time: 870 Result is 2*X. % do calculation at compile time! 871\end{verbatim} 872\end{quote} 873All compiled calls to \predspec{double/2} will now be preprocessed by being 874passed 875to \predspec{trans_double/2}. 876For example, if we now compile the following predicate involving 877\predspec{double/2}: 878\begin{quote} 879\begin{verbatim} 880sample :- 881 double(12, Y), ..., double(Y, Z). 882\end{verbatim} 883\end{quote} 884then the first call to double will be replaced by \notation{Y~=~24} while the 885second one will be unaffected. The code that the compiler sees and 886compiles is therefore 887\begin{quote} 888\begin{verbatim} 889sample :- 890 Y = 24, ..., double(Y, Z). 891\end{verbatim} 892\end{quote} 893Note that meta-calls (e.g., via 894\bipref{call/1}{../bips/kernel/control/call-1.html}) are never 895preprocessed, they always go directly to the definition of \predspec{double/2}. 896 897Transformation can be disabled for debugging purposes by adding 898\begin{quote} 899\begin{verbatim} 900:- pragma(noexpand). 901\end{verbatim} 902\end{quote} 903to the compiled file, or by setting the global flag 904\begin{quote} 905\begin{verbatim} 906:- set_flag(goal_expansion, off). 907\end{verbatim} 908\end{quote} 909 910 911%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 912\subsection{Clause Expansion} 913%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 914Before compilation, the compiler also performs clause macro expansion 915(\bipref{macro/3}{../bips/kernel/syntax/macro-3.html}). This includes 916the DCG grammar rule expansion (section \ref{dcg}). 917 918 919 920%---------------------------------------------------------------------- 921\section{Writing Efficient Code} 922\label{secefficientcode} 923%---------------------------------------------------------------------- 924Even with a declarative language, there are certain 925constructs which can be compiled more efficiently than others. 926It is however not recommended to write unreadable code with the aim 927of achieving faster execution - intuition is often wrong about which 928particular construct will execute more efficiently in the end. 929The advice is therefore 930\begin{quotation} 931 \emph{Try the simple and straightforward solution first!} 932\end{quotation} 933This will keep code maintainable, and will often be 934as fast or marginally slower than elaborate tricks. 935The second rule is to keep this original program even if you try 936to optimise it. You may find out that the optimisation 937was not worth the effort. 938{\eclipse} provides some support for finding those program parts 939that are worth optimizing. 940 941To achieve the maximum speed of your programs, choose the following compiler 942options: 943\begin{itemize} 944\item \notation{debug:off} ; 945\item \notation{opt_level:1} (the default); 946\item \notation{expand:on} (the default). 947\end{itemize} 948%Setting the flag {\tt variable_names} can also cause slight 949%performance degradations and it is thus better to have 950%it off, unless variable names have to be kept. 951%Unlike in the previous releases, the flag {\tt coroutine} 952%has now no influence on the execution speed. 953Some programs spend a lot of time in the garbage collection, 954collecting the stacks and/or the dictionary. 955If the space is known to be deallocated anyway, e.g., on failure, 956the programs can be often sped up considerably 957by switching the garbage collector off or by increasing 958the \notation{gc_interval} flag. 959As the global stack expands automatically, this does not cause 960any stack overflow, but it may of course exhaust the machine memory. 961 962When the program is running and its speed is still 963not satisfactory, use the profiling tools. 964The profiler can tell you which predicates 965are the most expensive ones, and the statistics tool 966tells you why. 967A program may spend its time in a predicate because the predicate 968itself is very time consuming, or because it was frequently executed. 969The port profiling tool gives you this information. 970It can also tell whether the predicate was slow because it 971has created a choice point or because there was too much 972backtracking due to bad indexing. 973 974One of the very important points is the selection 975of the clause that matches the current call. 976If there is only one clause that can potentially match, 977the compiler is expected to recognise this and generate code 978that will directly execute the right clause 979instead of trying several subsequent clauses until the 980matching one is found. 981Unlike most of the current Prolog compilers, the {\eclipse} 982compiler tries to base this selection ({\it indexing}) on the most suitable 983argument of the predicate.\footnote{% 984 The standard approach is to index only on the first argument.} 985It is therefore not necessary to reorder the predicate 986arguments so that the first one is the crucial argument 987for indexing. For example, in a predicate like 988\begin{quote} 989\begin{verbatim} 990p(a, a) :- a. 991p(b, a) :- b. 992p(a, b) :- c. 993p(d, b) :- d. 994p(b, c) :- e. 995\end{verbatim} 996\end{quote} 997calls where the first argument is instantiated, like \notation{p(d,Y)}, will be 998indexed on the first argument, while calls where the second argument is 999instantiated, like \notation{p(X,b)}, will be indexed on the second. 1000 1001However, the decision is still based on only one argument at a time: 1002a call like \notation{p(d,b)} will be indexed on the first argument only 1003(not because it is the first, but because it is more discriminating 1004than the second). If it is crucial that such a procedure is executed 1005as fast as possible with such a calling pattern, it can help to define 1006an auxiliary procedure which will be indexed on the other argument: 1007\begin{quote} 1008\begin{verbatim} 1009p(X, a) :- pa(X). 1010p(X, b) :- pb(X). 1011p(b, c) :- e. 1012 1013pa(a) :- a. pa(b) :- b. 1014 1015pb(a) :- c. pb(d) :- d. 1016\end{verbatim} 1017\end{quote} 1018 1019The compiler also tries to use for indexing all type-testing information 1020that appears at the beginning of the clause body (or beginning of a 1021disjunction): 1022\begin{itemize} 1023 1024\item Type testing predicates, i.e., 1025 \bipref{free/1}{../bips/kernel/typetest/free-1.html}, 1026 \bipref{var/1}{../bips/kernel/typetest/var-1.html}, 1027 \bipref{meta/1}{../bips/kernel/typetest/meta-1.html}, 1028\bipref{atom/1}{../bips/kernel/typetest/atom-1.html}, 1029\bipref{integer/1}{../bips/kernel/typetest/integer-1.html}, 1030\bipref{rational/1}{../bips/kernel/typetest/rational-1.html}, 1031\bipref{float/1}{../bips/kernel/typetest/float-1.html}, 1032\bipref{breal/1}{../bips/kernel/typetest/breal-1.html}, 1033\bipref{real/1}{../bips/kernel/typetest/real-1.html}, 1034\bipref{number/1}{../bips/kernel/typetest/number-1.html}, 1035\bipref{string/1}{../bips/kernel/typetest/string-1.html}, 1036\bipref{atomic/1}{../bips/kernel/typetest/atomic-1.html}, 1037\bipref{compound/1}{../bips/kernel/typetest/compound-1.html}, 1038\bipref{nonvar/1}{../bips/kernel/typetest/nonvar-1.html} and 1039\bipref{nonground/1}{../bips/kernel/typetest/nonground-1.html}. 1040 1041\item Explicit unification and value testing 1042\txtbipref{=/2}{(=)/2}{../bips/kernel/termcomp/E-2.html}, 1043\txtbipref{==/2}{(==)/2}{../bips/kernel/termcomp/EE-2.html}, 1044\biptxtrefni{\bsl==/2}{'\\=='/2}{../bips/kernel/termcomp/REE-2.html}% 1045\index{\bsl==/2@\bsl\notation{==/2}} 1046and 1047\biptxtrefni{\bsl=/2}{'\\='/2}{../bips/kernel/termcomp/RE-2.html}\index{\bsl=/2@\bsl\notation{=/2}}. 1048 1049\item Combinations of tests with 1050 \txtbipref{,/2}{','/2}{../bips/kernel/control/C-2.html}, 1051 \bipref{;/2}{../bips/kernel/control/O-2.html}, 1052\bipref{not/1}{../bips/kernel/control/not-1.html}, 1053\txtbipref{$->$/2}{->/2}{../bips/kernel/control/-G-2.html}. 1054 1055%\item Arithmetic testing predicates 1056%\txtbipref{$<$/2}{(<)/2}{../bips/kernel/arithmetic/L-2.html}, 1057%\txtbipref{=$<$/2}{(=<)/2}{../bips/kernel/arithmetic/EL-2.html}, 1058%\txtbipref{$>$/2}{(>)/2}{../bips/kernel/arithmetic/G-2.html}, 1059%\txtbipref{$>=$/2}{(>=)/2}{../bips/kernel/arithmetic/GE-2.html} if one argument 1060%is an integer constant and the 1061%other one known to be of the integer type. 1062 1063\item A cut after the type tests. 1064\end{itemize} 1065 1066If the compiler can decide about the clause selection at compile time, 1067the type tests are never executed and thus they incur no overhead. 1068When the clauses are not disjoint because of the type tests, either a cut 1069after the test or more tests into the other clauses can be added. 1070For example, the following procedure will be recognised as deterministic 1071and all tests are optimised away: 1072 1073\begin{verbatim} 1074 % a procedure without cuts 1075 p(X) :- var(X), ... 1076 p(X) :- (atom(X); integer(X)), X \= [], ... 1077 p(X) :- nonvar(X), X = [_|_], ... 1078 p(X) :- nonvar(X), X = [], ... 1079\end{verbatim} 1080 1081Another example: 1082\begin{verbatim} 1083 % A procedure with cuts 1084 p(X{_}) ?- !, ... 1085 p(X) :- var(X), !, ... 1086 p(X) :- integer(X), ... 1087 p(X) :- real(X), ... 1088 p([H|T]) :- ... 1089 p([]) :- ... 1090\end{verbatim} 1091 1092%Integers less than or greater than a constant can also be 1093%recognised by the compiler: 1094%\begin{verbatim} 1095% p(X) :- integer(X), X < 5, ... 1096% p(7) :- ... 1097% p(9) :- ... 1098% p(X) :- integer(X), X >= 15, ... 1099%\end{verbatim} 1100 1101%If the clause contains tests of several head arguments, only the 1102%first one is taken into account for indexing. 1103 1104Here are some more hints for efficient coding with {\eclipse}: 1105\begin{itemize} 1106 1107\item Arguments which are repeated in the clause head and in the first 1108regular goal in the body do not require any data moving and thus 1109they do not cost anything. For example, 1110\begin{quote} 1111\begin{verbatim} 1112p(X, Y, Z, T, U) :- q(X, Y, Z, T, U). 1113\end{verbatim} 1114\end{quote} 1115is just as cheap as 1116\begin{quote} 1117\begin{verbatim} 1118p :- q. 1119\end{verbatim} 1120\end{quote} 1121On the other hand, switching arguments requires data moves and so 1122\begin{quote} 1123\begin{verbatim} 1124p(A, B, C) :- q(B, C, A). 1125\end{verbatim} 1126\end{quote} 1127is somewhat more expensive. 1128 1129\item When accessing an argument of a 1130structure whose functor is known, unification and 1131\bipref{arg/3}{../bips/kernel/termmanip/arg-3.html} are both similarly 1132efficient, so the question of whether to write 1133\notation{Struct = emp(_,~X,~_)} or 1134\notation{arg(2,~Struct,~X)} is just a matter of taste and style. 1135 1136We recommend that the structure notation (see section~\ref{chapstruct}) 1137\index{structures} 1138be used, as it improves readability without adding any overhead. 1139So, for example, use \notation{Struct~=~emp\{salary:X\}} or 1140\notation{arg(salary~of~emp,~Struct,~X)}. 1141 1142\item Tests are generally rather slow unless they can be compiled away 1143(see \about{indexing}). 1144%\item When processing all arguments of a structure, using 1145%\txtbipref{=../2}{(=..)/2}{../bips/kernel/termmanip/EDD-2.html} 1146%and list predicates is always faster, more readable 1147%and easier analyzable by automated tools than using 1148%\bipref{functor/3}{../bips/kernel/termmanip/functor-3.html} 1149%and \bipref{arg/3}{../bips/kernel/termmanip/arg-3.html} loops. 1150 1151%\item Similarly, when adding one new element to a structure, using {\bf =../2} 1152%and \bipref{append/3}{../bips/lib/lists/append-3.html} is faster than 1153%functor/arg. 1154 1155\item Waking is more expensive (due to the priority mechanism) than metacalling 1156which is more expensive than compiled calls. 1157Metacalls however do not carry as heavy a penalty as in 1158some other Prolog systems. 1159 1160\item Sorting using \bipref{sort/2}{../bips/kernel/termcomp/sort-2.html} is very 1161 efficient and it does not use 1162much space. 1163Using \bipref{setof/3}{../bips/kernel/allsols/setof-3.html}, 1164\bipref{findall/3}{../bips/kernel/allsols/findall-3.html} etc. is also efficient 1165enough 1166to be used every time a list of all solutions is needed. 1167 1168%\item using {\bf not not Goal} is optimised in the compiler 1169%to use only one choice point. 1170 1171\item \txtbipref{=/2}{=/2}{../bips/kernel/termcomp/E-2.html} and 1172\txtbipref{==/2}{==/2}{../bips/kernel/termcomp/EE-2.html} 1173are faster than 1174\txtbipref{=:=/2}{=:=/2}{../bips/kernel/arithmetic/ENE-2.html}. 1175 1176\item \txtbipref{:/2}{:/2}{../bips/kernel/control/N-2.html} is optimised away 1177 by the compiler 1178if both arguments are known. 1179 1180\item Starting from {\eclipse} 6.0, there is no performance difference between 1181using multiple clauses or using disjunction or if-then-else cascades. 1182In fact, the compiler normalises multiple clause predicates into 1183a single-clause representation with inline disjunctions. 1184Disjunctions are indexed. 1185 1186\item Conditionals 1187(i.e., \notation{$\ldots$->$\ldots$;$\ldots$}) are compiled 1188more efficiently if the condition is an indexable built-in test. 1189 1190\end{itemize} 1191 1192 1193%---------------------------------------------------------------------- 1194\section{Implementation Notes} 1195%---------------------------------------------------------------------- 1196 1197The {\eclipse} compiler is actually contained in the eclipse library 1198\notation{lib(ecl_compiler)} which relies on a number of auxiliary modules. 1199It uses 1200\biptxtref{lib(source_processor)}{library(source_processor)}{../bips/lib/source_processor/index.html} 1201to read programs, and produces abstract 1202machine code that is assembled using 1203\biptxtref{lib(asm)}{library(asm)}{../bips/lib/asm/index.html}. 1204 1205The built-in predicate \bipref{als/1}{../bips/kernel/compiler/als-1.html} 1206or \bipref{asm:wam/1}{../bips/lib/asm/wam-1.html} 1207lists the abstract code of the given predicate and it can thus be used by 1208experts 1209to check if the predicate was compiled as expected. 1210 1211 1212 1213%HEVEA\cutend 1214 1215 1216 1217 1218 1219