реф

 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
$ENTRY Go {
= <Prout <Calc <MakeNumbers <Card>>>>;
}
Check {
e.1 = <DoCheck('0123456789+* ()') e.1>;
}
DoCheck {
(e.L s.X e.R) s.X e.1 =
<DoCheck (e.L s.X e.R) e.1>;
(e.S) = ;
e.1 = INVALID INPUT;
}
Spar { e.1 = <Spar1 (L) e.1>; }
Spar1 {
(e.S) '(' e.T = <Spar1 ((e.S)) e.T>;
((e.S) e.1) ')' e.T =
<Spar1 (e.S (e.1)) e.T>;
(L e.S) ')' e.T = ERROR;
(e.S) s.X e.T =
<Spar1 (e.S s.X) e.T>;
(L e.S) = e.S;
(e.S) = ERROR;
}
MakeNumbers {
' ' e.1 = <MakeNumbers e.1>;
'(' e.1 ')' = <MakeNumbers e.1>;
'+' e.1 ' ' e.2 = '+' Numb(e.1) ' ' <MakeNumbers e.2>;
'+' e.1 '(' e.2 ')' = '+' Numb(e.1) '(' <MakeNumbers e.2> ')';
'*' e.1 ' ' e.2 = '*' Numb(e.1) ' '<MakeNumbers e.2>;
'*' e.1 '(' e.2 ')' = '*' Numb(e.1) '('<MakeNumbers e.2> ')';
e.1 ' ' e.2 = Numb(e.1) <MakeNumbers e.2>;
e.1 = Numb(e.1);
}
Calc {
' ' e.1 = <Calc e.1>;
'+' e.1 = <Prout e.1> <AddMy e.1>;
'*' e.1 = <Prout e.1> <MulMy e.1>;
'(' e.1 ')' = <Calc e.1>;
s.1 = s.1;
}
AddMy {
' ' e.1 = <AddMy e.1>;
'(' e.1 ')' = <Calc e.1>;
t.1 = <Prout t.1> t.1;
t.1 e.2 = <Prout 'first' t.1> <Prout 'second' <AddMy e.2>> <Add t.1 <AddMy e.2>>;
}
MulMy {
' ' e.1 = <MulMy e.1> <Prout 'Mul'>;
'(' e.1 ')' = <Calc e.1> <Prout 'Mul'>;
t.1 = <Prout t.1> t.1 <Prout 'Mul'>;
t.1 e.2 = <Prout 'Mul'> <Mul t.1 <MulMy e.2>>;
}