fmcat


Name

fmcat -- catenate two machines

Synopsis

fmcat fm1 fm2

fmcat fm2 <fm1


Description

fmcat computes the catenation of fm1 and fm2, writing the result on the standard output. fm1 and fm2 need not be distinct. fmcat does not introduce empty-string instructions. It catenates the machines by connecting the final states of fm1 to the targets of start states in fm2, and appending any other instructions. Before catenation, the states in fm2 are renumbered so there are no collisions with states in fm1.

fm1 and fm2 must conform to the Grail format for machines.


Examples

% cat dfm1
(START) |- 0
0 a 1
1 b 2
2 -| (FINAL)

% fmcat dfm1 dfm1
(START) |- 0
0 a 1 
1 b 2 
2 a 4 
4 b 5 
5 -| (FINAL) 

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

% fmcat nfm2 dfm1
(START) |- 1
1 a 2 
1 a 3 
1 a 4 
2 a 6 
3 a 6 
4 a 6 
6 b 7 
7 -| (FINAL) 

Authors

Darrell Raymond and Derick Wood, the Grail project

See also

fm(5)