fmrevers


Name

fmrevers -- reverse a machine

Synopsis

fmrevers fm

fmrevers <fm


Description

fmrevers reverses the direction of all instructions in fm and writes the result on standard output. All start states become final states and vice versa. The input need not be deterministic. The output will be nondeterministic if fm contains more than one final state (since a deterministic machine can have only one start state).

fm must conform to the Grail format for machines.


Examples

% cat dfm5
(START) |- 0
0 a 1
1 c 2
2 e 3
3 -| (FINAL)
1 b 0
2 d 0

% fmrevers dfm5
(START) |- 3
1 a 0
0 b 1
2 c 1
0 d 2
3 e 2
0 -| (FINAL)

% cat nfm
(START) |- 1
1 a 2
1 a 3
1 a 4
2 -| (FINAL)
3 -| (FINAL)
4 -| (FINAL)

% fmrevers <nfm2
(START) |- 2
(START) |- 3
(START) |- 4
2 a 1
3 a 1
4 a 1
1 -| (FINAL)


Authors

Darrell Raymond and Derick Wood, the Grail project

See also

fm(5)