source: src/compdic/fsm2aut

Last change on this file was e7de6cc, checked in by Tomasz Obrebski <to@…>, 13 years ago

new version of dgp
added dgc, tre and compdic components
compiledic renamed to compdic_utf8
./configure updated

  • Property mode set to 100755
File size: 647 bytes
Line 
1#!/usr/bin/perl
2
3my $currstate=-1;
4my @states;
5my @final;
6my $tn=0;
7
8while(<>)
9{
10  if(/^\s*([0-9]+)\s+([0-9]+)\s+(.)(\s*)?$/)
11  {
12    push @{$states[$1]}, ($3, $2);
13    $#states=$2 if $#states<$2;
14    $tn++;
15  }
16  elsif(/^\s*([0-9]+)\s*$/)
17  {
18    $final[$1]=1;
19    $#states=$1 if $#states<$1;
20  }
21  else
22  {
23    die("Input error.");
24  }
25}
26
27print scalar(@states)," ",$tn," char void\n";
28
29my $i=0;
30my $width=int(log(@states+1)/log(10));
31foreach $stateref (@states)
32{
33  $f = ($final[$i]?"+":"-");
34  printf "%${width}d %s",$i++,$f;
35  while(@$stateref)
36  {
37    $c=shift @$stateref;
38    $s=shift @$stateref;
39    print " $c $s";
40  }
41  print "\n";
42}
43
44 
Note: See TracBrowser for help on using the repository browser.