1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
using System;
// Disables lots of warnings that appear in the test suite
#pragma warning disable 0168, 0169, 0219, 0162, 0414
namespace Test {
class Test
{
static readonly sbyte []_state_act_to_state_actions = { 0, 0, 1, 4, 6, 4, 0, };
static readonly sbyte []_state_act_from_state_actions = { 0, 0, 2, 5, 7, 5, 0, };
static readonly sbyte []_state_act_nfa_targs = { 0, 0, };
static readonly sbyte []_state_act_nfa_offsets = { 0, 0, 0, 0, 0, 0, 0, };
static readonly sbyte []_state_act_nfa_push_actions = { 0, 0, };
static readonly sbyte []_state_act_nfa_pop_trans = { 0, 0, };
static readonly int state_act_start = 4;
static readonly int state_act_first_final = 4;
static readonly int state_act_error = 0;
static readonly int state_act_en_main = 4;
static readonly int state_act_en_main_line_again = 3;
int cs;
void init()
{
{
cs = (int)state_act_start;
}
}
void exec( char[] data, int len )
{
int p = 0;
int pe = len;
int eof = len;
string _s;
char [] buffer = new char [1024];
int blen = 0;
{
if ( p == pe )
goto _test_eof;
if ( cs == 0 )
goto _out;
_resume:
switch ( _state_act_from_state_actions[cs] ) {
case 5:
{Console.Write( "b2\n" );}
break;
case 2:
{Console.Write( "c2\n" );}
break;
case 7:
{Console.Write( "a2\n" );}
{Console.Write( "b2\n" );}
break;
}
switch ( cs ) {
case 4:
if ( ( data[p ]) == '\u0068' )
{
goto ctr3;
}
{
goto ctr1;
}
case 0:
goto _out;
case 1:
if ( ( data[p ]) == '\u0069' )
{
goto ctr0;
}
{
goto ctr1;
}
case 2:
if ( ( data[p ]) == '\u000a' )
{
goto ctr2;
}
{
goto ctr1;
}
case 5:
if ( ( data[p ]) == '\u0068' )
{
goto ctr3;
}
{
goto ctr1;
}
case 3:
if ( ( data[p ]) == '\u0068' )
{
goto ctr3;
}
{
goto ctr1;
}
}
ctr1: cs = 0;
goto _again;
ctr3: cs = 1;
goto _again;
ctr0: cs = 2;
goto _again;
ctr2: cs = 5;
goto f2;
f2:
{cs = 3;}
goto _again;
_again:
switch ( _state_act_to_state_actions[cs] ) {
case 4:
{Console.Write( "b1\n" );}
break;
case 1:
{Console.Write( "c1\n" );}
break;
case 6:
{Console.Write( "a1\n" );}
{Console.Write( "b1\n" );}
break;
}
if ( cs == 0 )
goto _out;
p+= 1;
if ( p != pe )
goto _resume;
_test_eof: {}
_out: {}
}
}
void finish( )
{
if ( cs >= state_act_first_final )
Console.WriteLine( "ACCEPT" );
else
Console.WriteLine( "FAIL" );
}
static readonly string[] inp = {
"hi\nhi\n",
};
static readonly int inplen = 1;
public static void Main (string[] args)
{
Test machine = new Test();
for ( int i = 0; i < inplen; i++ ) {
machine.init();
machine.exec( inp[i].ToCharArray(), inp[i].Length );
machine.finish();
}
}
}
}
|