Runs an interactive shell where typed commands are interepreted
as DCG phrases. The cumulative result of all these phrases takes
the DCG state from S1 to S2. If present, Id is used to identify
the shell and is written as part of the prompt. The default prompt
Pressing Ctrl-D at the prompt or typing 'halt' or 'end_of_file'
terminates the shell unifying S2 with the final state. The command
'fail' terminates the shell and causes dcgshell/2 or dcgshell/3 as
a whole to fail, without leaving any choice points.
dcgshell/4 allows the specification of an alternate interpreter
other than call_dcg/3, which is the default in the other forms.
- Switches context module of interpreter to M.
- Change to a new interpreter. Eg,
cause timing information to be printed after each
command is interpreted.
- X ^ Phrase
- Causes Phrase to be interpreted after binding X to the
id of the current interpreter. Since the id can be any
term, you can use it as simple sort of environment in which
you can keep data that might be useful later on.