RosettaCodeData/Task/Universal-Turing-machine/Mercury/universal-turing-machine-2.mercury
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

17 lines
718 B
Text

:- type incrementer_states ---> a ; halt.
:- type incrementer_symbols ---> b ; '1'.
:- func incrementer_config = config(incrementer_states, incrementer_symbols).
incrementer_config = config(a, % the initial state
set([halt]), % the set of halting states
b). % the blank symbol
:- pred incrementer(incrementer_states::in,
incrementer_symbols::in,
incrementer_symbols::out,
action::out,
incrementer_states::out) is semidet.
incrementer(a, '1', '1', right, a).
incrementer(a, b, '1', stay, halt).
TapeOut = turing(incrementer_config, incrementer, [1, 1, 1]).