next up previous contents
Next: 7 Access Primitives Up: RELFUN Guide: Programming with Previous: 5 The Module System

6 Interaction Commands

 

The following functions and commands, in alphabetical order, are provided by the RELFUN interface.

{asm:

Short form of assem

assem:

Format: assem [ put ;<file-name;> | get ;<file-name;> |
;<mod-cmd;> [;<module-name;>] | ;<list-cmd;> [;<start;> [;<end;>]] ]

(where mod-cmd ::= mod | module | modules and list-cmd ::= l | listing)

Effect: assem : assemble compiler database (compile and verti also
assemble the database, so this command is not yet necessary!),
assem put ;<file-name;> : stores the assembler code
of all operators in compiler database in file ;<file-name;>;
compile or verti must have been used first! (;<file-name;> must
be a string enclosed in double quotes),
assem get ;<file-name;> : retrieve assembler code from
file ;<file-name;> and link it (this allows to use operators
compiled in previous sessions without having to load the source
code again and compile it; be careful:
listing / listcode / listclass will not show information
on operators *only* loaded with assem get),
assem modules (or mod / module instead of modules) :
show interesting information on all current modules
(name, size, position of hashtable, imports),
assem module ;<name;> (or mod instead of module) :
show contents of module ;<name;> (each entry consists of three
cells: label name, address, additional information),
assem listing [;<start;> [;<end;>]]
(or l instead of listing) :
list memory section; if ;<end;> is omitted, list 20 cells;
if ;<start;> and ;<end;> are omitted, list next 20 cells
starting one cell behind the last displayed cell).

see also: horizon, verti, compile

az:

Format: az ;<clause;>

Options: ;<clause;> a RELFUN clause

Effect: The ;<clause;> will be inserted at the end of the (possibly empty) current database module.

see also: a0, azhn, azft, consult, destroy, replace

azft:

Format: azft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>

Options: ;<head;> the head,
;<body1;> ... ;<bodyn;> the bodies,
;<foot;> the foot of an ft clause.

Effect: The clause (ft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>) will be inserted at the end of the (possibly empty) current database module. This command is an abbreviation of az (ft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>). Not available in P-syntax.

see also: az, azhn, consult, destroy, replace

azhn:

Format: azhn ;<head;> ;<body1;> ... ;<bodyn;>

Options: ;<head;> the head,
;<body1;> ... ;<bodyn;> the bodies of an hn clause.

Effect: The clause (hn ;<head;> ;<body1;> ... ;<bodyn;>) will be inserted at the end of the (possibly empty) current database module. This command is an abbreviation of az (hn ;<head;> ;<body1;> ... ;<bodyn;>). Not available in P-syntax.

see also: az, azft, consult, destroy, replace

a0:

Format: a0 ;<clause;>

Options: ;<clause;> a RELFUN clause

Effect: The ;<clause;> will be inserted in front of the (possibly empty) current database module.

see also: az, a0hn, a0ft, consult, destroy, replace

a0ft:

Format: a0ft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>

Options: ;<head;> the head,
;<body1;> ... ;<bodyn;> the bodies, and
;<foot;> the foot of an ft clause.

Effect: The clause (ft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>) will be inserted in front of the (possibly empty) current database module. This command is an abbreviation of a0 (ft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>). Not available in P-syntax.

see also: a0, a0hn, consult, destroy, replace

a0hn:

Format: a0hn ;<head;> ;<body1;> ... ;<bodyn;>

Options: ;<head;> the head, and
;<body1;> ... ;<bodyn;> the bodies of an hn clause.

Effect: The clause (hn ;<head;> ;<body1;> ... ;<bodyn;>) will be inserted in front of the (possibly empty) current database module. This command is an abbreviation of a0 (hn ;<head;> ;<body1;> ... ;<bodyn;>). Not available in P-syntax.

see also: a0, a0ft, consult, destroy, replace

bal2bap:

Format: bal2bap ;<source-filename;> [;<dest-filename;>]

Options: ;<source-filename;>, ;<dest-filename;>: a pathname (if the pathname contains upper case letters it must be enclosed in double quotes). If no extension is provided, RELFUN extends the filenames with ".bat".

Effect: Reads a RELFUN-batch, written in L-syntax, from ;<source-filename;>, writes a pretty-printed version in P-syntax to ;<dest-filename;>, resp. standard-output, if no destination is specified.

see also: rf2rf, rf2rfp, rfp2rfp, rfp2rf, bap2bal

bap2bal:

Format: bap2bal ;<source-filename;> [;<dest-filename;>]

Options: ;<source-filename;>, ;<dest-filename;>: a pathname (if the pathname contains upper case letters it must be enclosed in double quotes). If no extension is provided, RELFUN extends the filenames with ".bat".

Effect: Reads a RELFUN-database, written in P-syntax, from ;<source-filename;>, writes a pretty-printed version in L-syntax to ;<dest-filename;>, resp. standard-output, if no destination is specified.

see also: rf2rf, rf2rfp, rfp2rfp, rfp2rf, bal2bap

break:

Format: break

Effect: For debugging purposes, you can enter the LISP system to inspect the LISP environment by typing the command break. The current status of the interpreter will not be changed. Especially you can continue RELFUN computing with the command more\ after returning from the LISP system.
Exiting from the LISP system is implementation dependent.

see also: emul

browse-sortbase:

Format: browse-sortbase

Effect: If a graphical interface is present, a sortbrowser is started.

see also: sortbase

builtins:

Format: builtins

Effect: This command lists the RELFUN builtins which can be used in your RELFUN programs.

see also: listing

bye:

Format: bye

Effect: exiting from the current RELFUN invocation

see also: relfun

classify:

Format: classify ;<op;>

Options: ;<op;> an operator

Effect: Produces classified clauses for ;<op;> from the horizontally compiled database. If ;<op;> is omitted, the classified clauses are created for the whole database.

see also: compile, codegen, verti

codegen:

Format: codegen ;<op;>

Options: ;<op;> an operator

Effect: Produces GWAM-code from the classified clauses for ;<op;>. If no operator is given, all classified clauses are transformed.

see also: compile, classify, verti

compile:

Format: compile ;<op;>

Options: ;<op;> an operator

Effect: If ;<op;> is given, compile calls horizon to compile the whole RELFUN compiler database horizontally and then compiles the operator ;<op;> vertically. If no argument is given, the whole compiler database will be horizontally and vertically compiled.
There is no difference between the command sequence (horizon, verti) and the command compile.

see also: consult, horizon, verti

compile-sortbase:

Format: compile-sortbase

Effect: Create an intern structure of the module sortbase with direct and indirect subsorts and individuals without changing sortbase itself. Cycles are detected.

complete-sortbase:

Format: complete-sortbase

Effect: Compare the extensional intersection with the instantiation of the intensional intersection for all pairs of sorts and give an error if there is a discrepancy.

see also: unique-sortbase

consult:

Format: consult ;<filename;>

Options: ;<filename;> a pathname (if the pathname contains upper case letters it must be enclosed in double quotes)

Effect: Loading a database from file ;<filename;> at the end of the (possibly empty) current database module. If no extension is provided, RELFUN extends the filename with ".rf" or ".rfp" (depending on the current syntax mode).

see also: destroy, replace, style

consult-sortbase:

Format: consult-sortbase ;<filename;>

Options: ;<filename;> a pathname (if the pathname contains upper case letters it must be enclosed in double quotes)

Effect: Loading a database from file ;<filename;> at the end of the (possibly empty) module sortbase. If no extension is provided, RELFUN extends the filename with ".rf" or ".rfp" (depending on the current syntax mode).

see also: destroy-sortbase, browse-sortbase, consult

deanon:

Effect: transform anonymous variables (id) to new (named) variables

see also: horizon

destroy:

Format: destroy

Effect: Destroy the current database module.

see also: consult, replace

destroy-sortbase:

Format: destroy-sortbase

Effect: Destroy the entire existing module sortbase.

see also: consult-sortbase

emul:

Format: emul [-nocopy]

Effect: With this command you are entering the emulator mode of RELFUN and a flat copy of the current module and its context is generated in compiler database. If -nocopy is given, no copy is generated.

see also: inter

endscript:

Format: endscript

Effect: If a script has been started, ;<endscript;> will terminate it.

see also: script

exec:

Format: exec ;<filename;>

Options: ;<filename;> a pathname

Effect: Executing batch commands from the file ;<filename;>. If no extension is provided, RELFUN extends the filename with ".bat". The batch file may again contain exec commands.

see also: endscript, script

hash:

Format: hash [on|off]

Effect: Without argument the current state (on or off) of the hash system is displayed.

With argument on hashing is activated.

With argument off hashing is deactivated.

Hashing is used to accelerate the interpreter by indexing the clauses of the entire database. Default value is on.

hitrans:

Format: hitrans

Effect: higher-order operator calls and higher-order structures are transformed.

See also: horizon

horizon:

Format: horizon

Effect: The RELFUN database will be horizontally compiled to the RELFUN kernel. If you want to compile the database with the command verti, use horizon first.

see: compile, verti

indexing:

Format: indexing { on | off | :min-clauses ;<no;> | :max-vars ;<no;> | :max-depth ;<no;> | :max-args ;<no;> | :debug on | :debug off }

Effect: without any option display current settings,
on (off) switches indexing on (off),
:min-clauses ;<no;> sets the minimal number of clauses for an indexable operator definition to ;<no;>,
:max-vars ;<no;> sets the maximal number of variables allowed in a constant block (block-variable-size) to ;<no;>,
:max-depth ;<no;> sets the maximal depth of the index tree to ;<no;>,
:max-args ;<no;> sets the maximal number of parallelly indexable arguments (index tree breadth) to ;<no;>,
:debug on (off): for internal use only

Mutually excluding options result in executing only the last one.

Example:
indexing off :min-clauses 5 on :debug off :
switches indexing on, debugging off and sets min-clauses to 5.

inter:

Format: inter

Effect: With this command you are leaving the emulator mode of RELFUN, and you return to the interpreter mode.

see also: emul

l:

Short form of listing

listclass:

Format: listclass
listclass ;<procedure-name/arity;>

Options: ;<procedure-name/arity;> an operator, including the arity

Effect: Lists the classified version of the procedure. If no argument is specified, the classification of all procedures is listed.

see also: listing, listcode

listcode:

Format: listcode
listcode ;<procedure/arity;>

Options: ;<procedure/arity;> a procedure, including the arity

Effect: Takes the WAM-code and and pretty prints it.
If no argument is specified, the WAM-code of all compiled procedures is listed.

see also: listing, listclass

listing:

Format: listing
listing ;<op;>
listing ;<pat;>

Options: ;<op;> an operator,
;<pat;> a head pattern

Effect: Shows the clauses in the current database module. If no argument is given, the whole database will be printed on the terminal.
If an operator is given, only those clauses in the current database module will be printed which use this operator as their procedure name.
If a pattern is given, only those clauses in the current database module will be printed whose head matches the pattern ;<pat;>.

see also: consult, l

load:

Format: load ;<file1;> ...

Options: ;<file1;>: name of a file (string or symbol)

Effect: Loads files and creates modules. The current module is not changed. If a module already exists in memory it is not reloaded.

see also: reload, msave, mhelp

m:

Short form of more

map:

Format: map ;<rfi-command;> [;<module1;> ...| -all]

Options: ;<rfi-command;>: a rfi command, ;<module1;>: name of a module

Effect: Executes the command on the given modules, resp. on all loaded modules.

see also: mhelp

mcd:

Format: mcd [;<module;>]

Options: ;<module;>: name of a module (string or symbol)

Effect: Sets the current module to ;<module;>. If the argument is omitted the workspace is taken.

see also: mhelp

mconsult:

Format: mconsult ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Extends the current module by consulting ;<module1;> ..., i.e. it makes copies from the arguments.

see also: mreconsult, mreplace, mhelp

mcreate:

Format: mcreate ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Creates empty modules in memory. None of the arguments must exist.

see also: destroy, mdestroy, mhelp

mctx:

Format: mctx [+|-] ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Extends resp. reduces the context of the current module. A context is a list of module names. A goal will be evaluated in the database given by the clauses of the current module and the clauses of the modules in the context. Every module has its own context.

see also: mctx=, mhelp

mctx=:

Format: mctx= [;<module1;>] ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Sets the context of the current module. Without argument the context is cleared. A context is a list of module names. A goal will be evaluated in the database given by the clauses of the current module and the clauses of the modules in the context. Every module has its own context.

see also: mctx, mhelp

mdestroy:

Format: mdestroy [;<module1;> ...| -all]

Options: ;<module1;>: name of a module (string or symbol)

Effect: Removes modules from memory. With argument -all it removes all user modules from memory.

see also: load, mtell, mhelp

mflatten:

Format: mflatten ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Collects the modules and their contexts to create a flat list of clauses. The result is written into the current module.

see also: emul, mhelp

mforest:

Format: mforest ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Shows the module hierarchie in an indented ASCII representation.

see also: minfo, mhelp

mhelp:

Format: mhelp

Options:

Effect: Lists all commands of the module system with a one-line description.

There is a file RELFUN/RFM/demo/modules/module-demo.bat in the distribution demonstrating the capabilities of the module system by an example.

minfo:

Format: minfo

Options:

Effect: Shows context and name of the current module.

see also: mforest, mhelp

miser-level:

Format: miser-level [;<level;>]

Options: ;<level;>: an integer.

Effect: Without argument the current miser-level is displayed. With argument the miser-level is set to this value.

The miser-level influences the layout of the pretty printer in P-syntax. There are 4 possible values for ;<level;>:

mlist:

Format: mlist [;<pattern;>]

Options: ;<pattern;>: a head pattern (see listing)

Effect: Searches along the context for the pattern. If the argument is omitted, all accessable clauses are listed.

see also: listing, mhelp

more:

Format: more

Effect: If you asked a goal and you got one solution, you can get the next one. This is only possible if you haven't typed in another goal, and you haven't destroyed (modified) the database.

see also: m, ori

mreconsult:

Format: mreconsult ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Makes an update of the current module by reading clauses from a module. Existing predicates are replaced by the new ones. Nonexisting predicates extend the current module.

see also: reconsult, mconsult, mreplace, mhelp

mreplace:

Format: mreplace ;<module;> ...

Options: ;<module;>: name of a module (string or symbol)

Effect: Destroys the contents of the current module and consults ;<module;>

see also: mconsult, mreconsult, mhelp

msave:

Format: msave ;<module1;> ...

Options: ;<module1;>: name of a module (string or symbol)

Effect: Copies the modules from memory to the file system. Includes all sub modules.

see also: mtell, load, mhelp

mtell:

Format: mtell ;<module;> ...

Options: ;<module;>: name of a module (string or symbol)

Effect: Writes a copy of the current module to ;<module;>. If ;<module;> exists it is overwritten. If ;<module;> does not exist it is created.

see also: msave, mdestroy, mhelp

nospy:

Format: nospy

Effect: With this RELFUN command you leave the trace mode.

see also: spy

ori:

Format: ori

Effect: The previous goal (not command) will be reasked.

see also: more

prelude:

Format: prelude

Effect: list contents of prelude

see also: listing

print-width:

Format: print-width [;<width;>]

Options: ;<width;>: an integer.

Effect: Without argument the current print-width is displayed. With argument the print-width is set to this value.

reconsult:

Format: reconsult ;<filename;>

Options: ;<filename;> a pathname (if the pathname contains upper case letters it must be enclosed in double quotes)

Effect: If no extension is provided, RELFUN extends the filename with ".rf" or ".rfp" (depending on the current syntax mode). reconsult makes an update of the current module by reading clauses from a file. Existing predicates are replaced by the new ones. Nonexisting predicates extend the current module.

see also: consult, mreconsult, destroy, replace, style

relfun:

Format for style prolog: relfun()

Format within LISP and for style lisp: (relfun)

Effect: Invoking RELFUN from LISP or recursively inside RELFUN.

see also: bye , style

reload:

Format: reload ;<file1;> ...

Options: ;<file1;>: name of a file (string or symbol)

Effect: Loads files and replaces existing modules. All modules must exist in memory. The current module is not changed.

see also: load, msave, mhelp

replace:

Format: replace ;<filename;>

Options: ;<filename;> a pathname

Effect: Replacing the (possibly empty) current database module with the contents of the file ;<filename;> (for filename syntax and extension, see consult)

see also: destroy, consult

rf2rf:

Format: rf2rf ;<source-filename;> [;<dest-filename;>]

Options: ;<source-filename;>, ;<dest-filename;>: a pathname (if the pathname contains upper case letters it must be enclosed in double quotes). If no extension is provided, RELFUN extends the filenames with ".rf".

Effect: Reads a RELFUN-database, written in L-syntax, from ;<source-filename;>, writes a pretty-printed version to ;<dest-filename;>, resp. standard-output, if no destination is specified.

see also: rf2rfp, rfp2rfp, rfp2rf, bal2bap, bap2bal

rf2rfp:

Format: rf2rfp ;<source-filename;> [;<dest-filename;>]

Options: ;<source-filename;>, ;<dest-filename;>: a pathname (if the pathname contains upper case letters it must be enclosed in double quotes). If no extension is provided, RELFUN extends the source-file with ".rf" and the dest-file with ".rfp".

Effect: Reads a RELFUN-database, written in L-syntax, from ;<source-filename;>, writes a pretty-printed version in P-syntax to ;<dest-filename;>, resp. standard-output, if no destination is specified.

see also: rf2rf, rfp2rfp, rfp2rf, bal2bap, bap2bal

rfp2rf:

Format: rfp2rf ;<source-filename;> [;<dest-filename;>]

Options: ;<source-filename;>, ;<dest-filename;>: a pathname (if the pathname contains upper case letters it must be enclosed in double quotes). If no extension is provided, RELFUN extends the source-file with ".rfp" and the dest-file with ".rf".

Effect: Reads a RELFUN-database, written in P-syntax, from ;<source-filename;>, writes a pretty-printed version in L-syntax to ;<dest-filename;>, resp. standard-output, if no destination is specified.

see also: rf2rf, rf2rfp, rfp2rfp, bal2bap, bap2bal

rfp2rfp:

Format: rfp2rfp ;<source-filename;> [;<dest-filename;>]

Options: ;<source-filename;>, ;<dest-filename;>: a pathname (if the pathname contains upper case letters it must be enclosed in double quotes). If no extension is provided, RELFUN extends the filenames with ".rfp".

Effect: Reads a RELFUN-database, written in P-syntax, from ;<source-filename;>, writes a pretty-printed version to ;<dest-filename;>, resp. standard-output, if no destination is specified.

see also: rf2rf, rf2rfp, rfp2rf, bal2bap, bap2bal

rx:

Format: rx ;<clause;>

Options: ;<clause;> a RELFUN clause

Effect: The ;<clause;> will be removed from the current database module.

see also: rxft, rxhn, consult, destroy, replace

rxft:

Format: rxft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>

Options: ;<head;> the head,
;<body1;> ... ;<bodyn;> the bodies, and
;<foot;> the foot of an ft clause.

Effect: The clause (ft ;<head;> ;<body1;> ...b ;<bodyn;> ;<foot;>) will be removed from the current database module. This command is an abbreviation of rx (ft ;<head;> ;<body1;> ... ;<bodyn;> ;<foot;>). Not available in P-syntax.

see also: rx, rxhn, consult, destroy, replace

rxhn:

Format: rxhn ;<head;> ;<body1;> ... ;<bodyn;>

Options: ;<head;> the head, and
;<body1;> ... ;<bodyn;> the bodies of an hn clause.

Effect: The clause (hn ;<head;> ;<body1;> ... ;<bodyn;>) will be removed from the current database module. This command is an abbreviation of rx (hn ;<head;> ;<body1;> ... ;<bodyn;>). Not available in P-syntax.

see also: rx, rxft, consult, destroy, replace

script:

Format: script ;<filename;>

Options: ;<filename;> a pathname

Effect: All input and output activity will be logged in the file ;<filename;>. This is useful to analyse traces or to protocol examples stored in a file and run within a batchjob.

see also: endscript, exec

showdepth:

Format: showdepth ;<n;>

Options: ;<n;> a number

Effect: If the system is in trace mode, the output length of the conjunction printing will be limited to the number ;<n;>. If this number is 0, no limitation exists. This value is the default.

see also: spy, nospy

sl:

Short form of style lisp

sortbase:

Format: sortbase

Effect: Shows the clauses in the module sortbase.

see also: listing, browse-sortbase

sp:

Short form of style prolog

spy:

Format: spy

Effect: This activates the spy mode of the RELFUN system. After entering the interpreter spy mode, the conjunction of (sub-)goals to be solved is printed on the terminal. The environment is used to instantiate these remaining conjuncts.

see also: nospy, showdepth

strict-sortbase:

Format: strict-sortbase

Effect: Give an error if a list of sortbase individuals is empty.

see also: complete-sortbase, unique-sortbase

style:

Format: style lisp
style prolog

Effect: style lisp turns LISP-like syntax on,
style prolog turns PROLOG-like syntax on.

See also: sl, sp

tell:

Format: tell ;<filename;>

Options: ;<filename;> a string or a filename

Effect: The current database module will be stored in the file ;<filename;>. If no extension is provided, RELFUN extends the filename with ".rf" or ".rfp".

see also: consult, destroy, replace

timermode:

Format: timermode [on|off]

Effect: Without argument the current timermode is displayed.

With argument on timermode is activated, i.e. the execution times of goals will be printed.

With argument off timermode is deactivated.

trace:

Format: trace {;<procedure;>}

 
  where 		 procedure ::= { 		 -all | -rest | {\+\+

[;<head-functor;>]

[-incl ;<i-list;>]

[-excl ;<i-list;>]

[-print-p ;<symbol;>] } }

i-list ::= {;<integer;>} | ALL

Effect:
Without arguments: Print the names of all traced procedures or print: No procedures traced.
With arguments:

The tracer is based on the box-model of PROLOG. It uses the following symbols at begin of the line to indicate the kind of event:

 
  > 		 entering a procedure

| re-entering a procedure

< exiting a succeeded procedure

~procedure failed

~! procedure failed because of running from the right over a cut

~> procedure failed because there is no head that unifies

A number after the symbol denotes a clause.
After printing ``>'' and the head of the clause one of ``:-'', ``:- &'' signals a hornish resp. a footed clause.
After printing ``<'' and the head of the clause ``:-'' indicates a hornish clause, while ``:-&'' followed by the value of the clause indicates a footed clause.

There is a file called tracer.bat in the distribution which explains the tracer with examples.

see also: untrace

uncomma:

Format: uncomma

Effect: remove comma expressions (and inline expandable lambda expressions)

See also: horizon

unique-sortbase:

Format: unique-sortbase

Effect: Create the intensional intersection for all pairs of sorts and give an error if an intersection contains more than one sort.

see also: complete-sortbase

unlambda:

Format: unlambda

Effect: remove lambda expressions that cannot be expanded inline

See also: horizon

unmacro:

Format: unmacro

Effect: remove some macros (let, let*, progn)

See also: horizon

unor:

Format: unor

Effect: transform or expressions into lambda expressions

See also: horizon

untrace

Format: untrace {;<head-functor;>}

Effect:
Without argument: Untrace all traced procedures.
With argument(s): Untrace the given procedure(s).

see also: trace

untype:

Format: untype

Effect: transform types (dom, exc, and $-terms) as well as bnd- and :-terms

See also: horizon

verti:

Format: verti ;<op;>

Options: ;<op;> an operator

Effect: If ;<op;> is given, verti vertically compiles the operator ;<op;>. If no argument is given, the whole compiler database will be vertically compiled.

see also: compile, horizon, classify, codegen

}


next up previous contents
Next: 7 Access Primitives Up: RELFUN Guide: Programming with Previous: 5 The Module System

Harold Boley (boley@informatik.uni-kl.de)