source: _old/app/src/compdic/fsm2aut @ 93afab8

Last change on this file since 93afab8 was 93afab8, checked in by tom <tom@…>, 13 years ago

dodany komponent compdic - kompilator slownikow dla lem, cor, kor, gue
(compdic zastepuje compiledic)

  • 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.