blob: 58a31dcab7209e9c8b0e9e148ee2dfc72d4b35de (
plain)
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
|
/*
* @LANG: indep
*/
bool i;
bool j;
bool k;
%%{
machine foo;
action c1 {i}
action c2 {j}
action c3 {k}
action one { print_str " one\n";}
action two { print_str " two\n";}
action three { print_str " three\n";}
action seti {
if ( fc == 48 ) {
i = false;
} else {
i = true;
}
}
action setj {
if ( fc == 48 ) {
j = false;
} else {
j = true;
}
}
action setk {
if ( fc == 48 ) {
k = false;
} else {
k = true;
}
}
action break {fnbreak;}
one = 'a' 'b' when c1 'c' @one;
two = 'a'* 'b' when c2 'c' @two;
three = 'a'+ 'b' when c3 'c' @three;
main :=
[01] @seti
[01] @setj
[01] @setk
( one | two | three ) '\n' @break;
}%%
##### INPUT #####
"000abc\n"
"100abc\n"
"010abc\n"
"110abc\n"
"001abc\n"
"101abc\n"
"011abc\n"
"111abc\n"
##### OUTPUT #####
FAIL
one
ACCEPT
two
ACCEPT
one
two
ACCEPT
three
ACCEPT
one
three
ACCEPT
two
three
ACCEPT
one
two
three
ACCEPT
|