source: _old/nawszelkiwypadek/tools/fsm2aut @ 743cc4f

Last change on this file since 743cc4f was 57728c1, checked in by Mateusz Hromada <ruanda@…>, 15 years ago

Move old files to _old dir.

  • Property mode set to 100755
File size: 647 bytes
RevLine 
[25ae32e]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.