The FSA command interpreter provides line-based interaction with the FSA functionality. The command interpreter provides a history mechanism, escape to the operating system, escape to Prolog and on-line help information. All startup options for fsa are also available as commands in the command interpreter.
A command is typed in by the user as one line of text; it's tokenized as a sequence of `words', where spaces and tabs are treated as separators. Each word is treated as an atomic (Prolog atom or Prolog integer), unless it is written within { and }. In the latter case the `word' is parsed as a Prolog term (in the latter case spaces and tabs are not interpreted as separators).
|: flag jan jan(a,b,c)
is equivalent to the Prolog goal
?- fsa_globals:fsa_global_set(jan,'jan(a,b,c)')
wherease
|: flag jan {jan(a,b,c)}
is equivalent to the Prolog goal
?- fsa_globals:fsa_global_set(jan,jan(a,b,c))
Variables occuring in such terms have scope over the full command-line!
The command-interpreter has an alias mechanism which subsumes a history mechanism as well. All occurences of $word are replaced by the definition of the alias word. The alias command itself can be used to define aliases:
19 |: alias hallo ! cat hallo
20 |: $hallo
so command number 20 will have the same effect as typing
33 |: ! cat hallo
and if this command had indeed been typed as command number 33 then typing
35 |: $33
gives also the same result. The special meaning of $ can be turned off by prefixing it with another $, e.g.:
|: cd $$HOME
Moreover, if no alias has been defined, then it will apply the last command that started with the name of the alias:
66 |: parse john kisses mary
67 |: $parse
will have the same meaning (in this order) if the macro parse is not defined.
It is also possible to issue Prolog commands; however some restrictions apply.
39 |: p {member(X,[X|T])}
Note that this may succeed, but 'yes' or 'no' and variable bindings will NOT be printed.
If no action option is provided, then the system runs in interactive mode. If the variable interpreter is set to on, then fsa runs in interactive mode after the action indicated by the action option has been performed. If the flag interactive has been set to cmdint, then fsa runs the FSA command interpreter. The command interpreter can be started any time from the Prolog prompt using the command r/0:
| ?- r.
*** Welcome to the FSA Command Interpreter (type ? for help) ***
5 |:
You can stop the command interpreter using the p command:
5 |: p
*** execution interrupted ***
yes
| ?-
You can quit FSA entirely using the quit command. Note that you can also use the command interpreter together with the graphical user interface.
Stops the command interpreter.
ignores Words (comment). Note that there needs to be a space after %.
fcompiles(Files).
use_module(Files).
ensure_loaded(Files).
compile(Files).
reconsult(Files).
load(Files).
for each File, use_module(library(File)).
for each File, reconsult(library(File)).
for each File, compile(library(File)).
for each File, ensure_loaded(library(File)).
for each File, load(library(File)).
displays version information.
quits FSA.
break; enters Prolog prompt at next break level.
debug/0.
nodebug/0.
without Goal: quits command interpreter -- falls back to Prolog prompt with Goal: calls Goal. Normally you will need {} around the Goal. For example:
4 |: p { member(X,[a,b,c]), write(X), nl }
Command is executed by the shell. Note that the space between ! and Command is required.
No args: lists all aliases; one arg: displays alias Name; two args: defines an alias Name with meaning Val.
displays help on Module-Class-Key; use ? to get help on commands only.
displays help on Cmd; without Cmd prints list of commands.
set spypoint on Module:Pred; Pred can either be Fun or Fun/Ar.
change working directory to Dir; without argument cd to home directory.
print working directory.
listing of directory contents
Any valid option you can give to the fsa command is a valid command for the command interpreter. For instance:
|: -d a.nd a.d
|: -m a.d a.m
|: -aux File
|: -tk
|: -r [[a,b]+,c]+