source: nawszelkiwypadek/tools/fsm2aut @ 843c58d

help
Last change on this file since 843c58d was f1563c0, checked in by obrebski <obrebski@…>, 17 years ago

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@3 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

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