GNU PROLOG
A Native Prolog Compiler with Constraint Solving over Finite Domains Edition 1.8, for GNU Prolog version 1.3.0 5th January, 2007 by Daniel Diaz |
| % gprolog [OPTION]... | (the % symbol is the operating system shell prompt) |
| –init-goal GOAL | execute GOAL before top_level/0 |
| –entry-goal GOAL | execute GOAL inside top_level/0 |
| –query-goal GOAL | execute GOAL as a query for top_level/0 |
| –help | print a help and exit |
| –version | print version number and exit |
| – | do not parse the rest of the command-line |
GNU Prolog 1.2.9 By Daniel Diaz Copyright (C) 1999-2007 Daniel Diaz | ?-
before GNU Prolog 1.2.9 By Daniel Diaz Copyright (C) 1999-2007 Daniel Diaz inside | ?- append([a,b],[c,d],X). X = [a,b,c,d] yes | ?-
| | ?- append(X,Y,[a,b,c]). | ||
| X = [] | ||
| Y = [a,b,c] ? ; | (here the user presses ; to compute another solution) | |
| X = [a] | ||
| Y = [b,c] ? a | (here the user presses a to compute all remaining solutions) | |
| X = [a,b] | ||
| Y = [c] | (here the user is not asked and the next solution is computed) | |
| X = [a,b,c] | ||
| Y = [] | (here the user is not asked and the next solution is computed) | |
| no | (no more solution) | |
| | ?- (X=1 ; X=2). | ||
| X = 1 ? ; | (here the user presses ; to compute another solution) | |
| X = 2 | (here the user is not prompted since there are no more alternatives) | |
| yes | ||
| | ?- (X=1 ; X=2). | ||
| X = 1 ? | (here the user presses RETURN to stop the execution) | |
| yes | ||
| | ?- X=f(A,B,_,A), A=k. | ||
| A = k | (the value of A is displayed also in f/3 for X) | |
| X = f(k,B,_,k) | (since B is a variable which is also a part of X, B is not displayed) | |
| | ?- functor(T,f,3), arg(1,T,X), arg(3,T,X). | ||
| T = f(X,_,X) | (the 1st and 3rd args are equal to X, the 2nd is an anonymous variable) | |
| | ?- read_from_atom('k(X,Y,X).',T). | ||
| T = k(A,_,A) | (the 1st and 3rd args are unified, a new variable name A is introduced) | |
| | ?- X='$VARNAME'('Y'), Y='$VAR'(1). | ||
| X = Y | (the term '$VARNAME'('Y') is displayed as Y) | |
| Y = '$VAR'(1) | (the term '$VAR'(1) is displayed as is) | |
| | ?- X=Y, Y='$VAR'(1). | ||
| X = '$VAR'(1) | ||
| Y = '$VAR'(1) |
| | ?- retractall(p(_)), assertz(p(0)), | ||
| repeat, | ||
| retract(p(X)), | ||
| Y is X + 1, | ||
| assertz(p(Y)), | ||
| X = 1000, !. | ||
| X = 1000 | ||
| Y = 1001 | ||
| (180 ms) yes | (the query took 180ms of user time) | |
| | ?- [user]. | ||
| {compiling user for byte code...} | ||
| even(0). | ||
| even(s(s(X))):- | ||
| even(X). | ||
| (here the user presses Ctl-D to end the input) | ||
| {user compiled, 3 lines read - 350 bytes written, 1180 ms} | ||
| | ?- even(X). | ||
| X = 0 ? ; | (here the user presses ; to compute another solution) | |
| X = s(s(0)) ? ; | (here the user presses ; to compute another solution) | |
| X = s(s(s(s(0)))) ? | (here the user presses RETURN to stop the execution) | |
| yes | ||
| | ?- listing. | ||
| even(0). | ||
| even(s(s(A))) :- | ||
| even(A). | ||
| Command | Name | Description |
| a | abort | abort the current execution. Same as abort/0 (section 7.18.1) |
| e | exit | quit the current Prolog process. Same as halt/0 (section 7.18.1) |
| b | break | invoke a recursive top-level. Same as break/0 (section 7.18.1) |
| c | continue | resume the execution |
| t | trace | start the debugger using trace/0 (section 4.3.1) |
| d | debug | start the debugger using debug/0 (section 4.3.1) |
| h or ? | help | display a summary of available commands |
| Key | Alternate key | Description |
| Ctl-B | ← | go to the previous character |
| Ctl-F | → | go to the next character |
| Esc-B | Ctl-← | go to the previous word |
| Esc-F | Ctl-→ | go to the next word |
| Ctl-A | Home | go to the beginning of the line |
| Ctl-E | End | go to the end of the line |
| Ctl-H | Backspace | delete the previous character |
| Ctl-D | Delete | delete the current character |
| Ctl-U | Ctl-Home | delete from beginning of the line to the current character |
| Ctl-K | Ctl-End | delete from the current character to the end of the line |
| Esc-L | lower case the next word | |
| Esc-U | upper case the next word | |
| Esc-C | capitalize the next word | |
| Ctl-T | exchange last two characters | |
| Ctl-V | Insert | switch on/off the insert/replace mode |
| Ctl-I | Tab | complete word (twice displays all possible completions) |
| Esc-Ctl-I | Esc-Tab | insert spaces to emulate a tabulation |
| Ctl-space | mark beginning of the selection | |
| Esc-W | copy (from the begin selection mark to the current character) | |
| Ctl-W | cut (from the begin selection mark to the current character) | |
| Ctl-Y | paste | |
| Ctl-P | ↑ | recall previous history line |
| Ctl-N | ↓ | recall next history line |
| Esc-P | recall previous history line beginning with the current prefix | |
| Esc-N | recall next history line beginning with the current prefix | |
| Esc-< | Page Up | recall first history line |
| Esc-> | Page Down | recall last history line |
| Ctl-C | generate an interrupt signal (section 3.2.4) | |
| Ctl-D | generate an end-of-file character (at the begin of the line) | |
| RETURN | validate a line | |
| Esc-? | display a summary of available commands |
| | ?- argu | (here the user presses Tab to complete the word) | |
| | ?- argument_ | (linedit completes argu with argument_ and emits a beep) | |
| (the user presses again Tab to see all possible completions) | ||
| argument_counter | (linedit shows 3 possible completions) | |
| argument_list | ||
| argument_value | ||
| | ?- argument_ | (linedit redisplays the input line) | |
| | ?- argument_c | (to select argument_counter the user presses c and Tab) | |
| | ?- argument_counter | (linedit completes with argument_counter) | |
| Stack | Default | Environment | Description |
| name | size (Kb) | variable | |
| local | 4096 | LOCALSZ | control stack (environments and choice-points) |
| global | 8192 | GLOBALSZ | heap (compound terms) |
| trail | 3072 | TRAILSZ | conditional bindings (bindings to undo at backtracking) |
| cstr | 3072 | CSTRSZ | finite domain constraint stack (FD variables and constraints) |
| LOCALSZ=8192; export LOCALS | (under sh or bash) | |
| setenv LOCALSZ 8192 | (under csh or tcsh) |
| Type | Speed | Debug ? | For what |
| interpreted-code | slow | yes | meta-call and dynamically asserted clauses |
| byte-code | medium | yes | consulted predicates |
| native-code | fast | no | compiled predicates |

| Suffix of the file | Type of the file | Handled by: |
| .pl, .pro | Prolog source file | pl2wam |
| .wam | WAM source file | wam2ma |
| .ma | Mini-assembly source file | ma2asm |
| .s | Assembly source file | the assembler |
| .c, .C, .CC, .cc, .cxx, .c++, .cpp | C or C++ source file | the C compiler |
| .fd | Finite Domain constraint source file | fd2c |
| any other suffix (.o, .a,...) | any other type (object, library,...) | the linker (C linker) |
| % gplc [OPTION]... FILE... | (the % symbol is the operating system shell prompt) |
| -o FILE, –output FILE | use FILE as the name of the output file |
| -W, –wam-for-native | stop after producing WAM files(s) |
| -w, –wam-for-byte-code | stop after producing WAM for byte-code file(s) (force –no-call-c) |
| -M, –mini-assembly | stop after producing mini-assembly files(s) |
| -S, –assembly | stop after producing assembly files (s) |
| -F, –fd-to-c | stop after producing C files(s) from FD constraint definition file(s) |
| -c, –object | stop after producing object files(s) |
| –temp-dir PATH | use PATH as directory for temporary files |
| –no-del-temp | do not delete temporary files |
| –no-decode-hexa | do not decode hexadecimal predicate names |
| -v, –verbose | print executed commands |
| -h, –help | print a help and exit |
| –version | print version number and exit |
| –pl-state FILE | read FILE to set the initial Prolog state |
| –no-susp-warn | do not show warnings for suspicious predicates |
| –no-singl-warn | do not show warnings for named singleton variables |
| –no-redef-error | no not show errors for built-in predicate redefinitions |
| –foreign-only | only compile foreign/1-2 directives |
| –no-call-c | do not allow the use of fd_tell, '$call_c',... |
| –no-inline | do not inline predicates |
| –no-reorder | do not reorder predicate arguments |
| –no-reg-opt | do not optimize registers |
| –min-reg-opt | minimally optimize registers |
| –no-opt-last-subterm | do not optimize last subterm compilation |
| –fast-math | use fast mathematical mode (assume integer arithmetics) |
| –keep-void-inst | keep void WAM instructions in the output file |
| –compile-msg | print a compile message |
| –statistics | print statistics information |
| –comment | include comments in the output file |
| –comment | include comments in the output file |
| –c-compiler FILE | use FILE as C compiler |
| -C OPTION | pass OPTION to the C compiler |
| -A OPTION | pass OPTION to the assembler |
| –local-size N | set default local stack size to N Kb |
| –global-size N | set default global stack size to N Kb |
| –trail-size N | set default trail stack size to N Kb |
| –cstr-size N | set default constraint stack size to N Kb |
| –fixed-sizes | do not consult environment variables at run-time (use default sizes) |
| –no-top-level | do not link the top-level (force –no-debugger) |
| –no-debugger | do not link the Prolog/WAM debugger |
| –min-pl-bips | link only used Prolog built-in predicates |
| –min-fd-bips | link only used FD solver built-in predicates |
| –min-bips | shorthand for: –no-top-level –min-pl-bips –min-fd-bips |
| –min-size | shorthand˛ for: –min-bips –strip |
| –no-fd-lib | do not look for the FD library (maintenance only) |
| -s, –strip | strip the executable |
| -L OPTION | Pass OPTION to the linker |
% gplc -W prog.pl % gplc -M --comment prog.wam % gplc -S --comment prog.ma % gplc -c prog.s % gplc -o prog -s prog.o
% gplc --no-top-level prog.pl % prog Warning: no initial goal executed use a directive :- initialization(Goal) or remove the link option --no-top-level (or --min-bips or --min-size)
| % hexgplc [OPTION]... FILE... | (the % symbol is the operating system shell prompt) |
| –encode | encoding mode (default mode is decoding) |
| –relax | decode also predicate names (not only predicate indicators) |
| –printf FORMAT | pass encoded/decoded string to C printf(3) with FORMAT |
| –aux-father | decode an auxiliary predicate as its father |
| –aux-father2 | decode an auxiliary predicate as its father + auxiliary number |
| –cmd-line | encode/decode each argument of the command-line |
| -H | same as: –cmd-line –encode |
| -P | same as: –cmd-line –relax |
| –help | print a help and exit |
| –version | print version number and exit |
% hexgplc -H 'x+y=z' X782B793D7A
