Lexer, UnLexer

 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
$ENTRY Go{
= <Prout <UnLexer <NormSkobki <Lexer <GetSymbol <Card> (1)(1)>>>>>;
}
Class {
s.Char = <DoClass
s.Char
(UpLetter 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
(LoLetter 'abcdefghijklmnopqrstuvwxyz')
(Digit '1234567890')
(EOF '!')
>;
}
DoClass {
s.Char (s.Class s.Char e.Tail) e.Classes = s.Class;
s.Char (s.Class s.OtherChar e.Tail)e.Classes = <DoClass s.Char (s.Class e.Tail) e.Classes>;
s.Char (s.Class) e.Classes = <DoClass s.Char e.Classes>;
s.Char = Other;
}
GetSymbol {
'!' e.Text (s.Line)(s.Col) = ('!' EOF s.Line s.Col);
'\n' e.Text(s.Line)(s.Col) = ('\n' Other s.Line s.Col) <GetSymbol e.Text (<Inc s.Line>) (1)>;
s.Char e.Text (s.Line)(s.Col) = (s.Char <Class s.Char> s.Line s.Col) <GetSymbol e.Text (s.Line)(<Inc s.Col>)>;
}
Inc {
e.Arg = <+ 1 e.Arg>;
}
Lexer {
(' ' Other s.Line s.Col)e.Tail = <Lexer e.Tail>;
(';' Other s.Line s.Col)e.Tail = (Semicolon (s.Line s.Col) ';' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
(':' Other s.Line s.Col)e.Tail = (Colon (s.Line s.Col) ';' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('<' Other s.Line s.Col)e.Tail = (OpenCall (s.Line s.Col) '\<' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('>' Other s.Line s.Col)e.Tail = (CloseCall (s.Line s.Col) '\>' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('(' Other s.Line s.Col)e.Tail = (OpenBracket (s.Line s.Col) '\(' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
(')' Other s.Line s.Col)e.Tail = (CloseBracket (s.Line s.Col) '\)' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('{' Other s.Line s.Col)e.Tail = (OpenBlock (s.Line s.Col) '{' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('}' Other s.Line s.Col)e.Tail = (CloseBlock (s.Line s.Col) '}' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('=' Other s.Line s.Col)e.Tail = (Assign (s.Line s.Col) '=' (s.Line <Inc s.Col>)) <Lexer e.Tail>;
('!' EOF s.Line s.Col)e.Tail = (EOF (s.Line s.Col) '!' (s.Line <Inc s.Col>));
('e' LoLetter s.Line s.Col)('.' Other s.Line1 s.Col1)e.Tail = '('EVar(s.Line s.Col) 'e.'<GetName e.Tail>;
('t' LoLetter s.Line s.Col)('.' Other s.Line1 s.Col1)e.Tail = '('TVar(s.Line s.Col) 't.'<GetName e.Tail>;
('s' LoLetter s.Line s.Col)('.' Other s.Line1 s.Col1)e.Tail = '('SVar(s.Line s.Col) 's.'<GetName e.Tail>;
(s.Char s.Class s.Line s.Col)(' ' s.Class1 s.Line1 s.Col1)e.Tail = (Char (s.Line s.Col) s.Char (s.Line1 s.Col1))<Lexer e.Tail>;
(s.Char Digit s.Line s.Col)e.Tail = '('Number(s.Line s.Col) s.Char<GetNumber e.Tail>;
(s.Char UpLetter s.Line s.Col)e.Tail = '('Name(s.Line s.Col) s.Char<GetName e.Tail>;
}
GetNumber {
(s.Char Digit s.Line s.Col)e.Tail = s.Char <GetNumber e.Tail>;
(' ' Other s.Line s.Col)e.Tail = (s.Line s.Col)')'<Lexer e.Tail>;
(s.Char s.Class s.Line s.Col)e.Tail = (s.Line s.Col)')'<Lexer (s.Char s.Class s.Line s.Col)e.Tail>;
}
GetName {
(s.Char UpLetter s.Line s.Col)e.Tail = s.Char<GetName e.Tail>;
(s.Char LoLetter s.Line s.Col)e.Tail = s.Char<GetName e.Tail>;
(s.Char Digit s.Line s.Col)e.Tail = s.Char<GetName e.Tail>;
('-' Other s.Line s.Col)e.Tail = '-'<GetName e.Tail>;
(' ' Other s.Line s.Col)e.Tail = (s.Line s.Col)')'<Lexer e.Tail>;
(s.Char s.Class s.Line s.Col)e.Tail = (s.Line s.Col)')'<Lexer (s.Char s.Class s.Line s.Col)e.Tail>;
}
NormSkobki {
e.Head'('e.Token')'e.Tail = e.Head(e.Token)<NormSkobki e.Tail>;
e.Body = e.Body;
}
UnLexer {
(s.Domen (e.BeginLine e.BeginCol) e.Lex (e.EndLine e.EndCal))(s.Domen1 (e.BeginLine e.BeginCol1) e.Lex1 (e.EndLine e.EndCal1))e.Tail =
e.Lex ' ' <UnLexer (s.Domen1 (e.BeginLine e.BeginCol1) e.Lex1 (e.EndLine e.EndCal1))e.Tail>;
(s.Domen (e.BeginLine e.BeginCol) e.Lex (e.EndLine e.EndCal))(s.Domen1 (e.BeginLine1 e.BeginCol1) e.Lex1 (e.EndLine1 e.EndCal1))e.Tail =
e.Lex '\n' <UnLexer (s.Domen1 (e.BeginLine1 e.BeginCol1) e.Lex1 (e.EndLine1 e.EndCal1))e.Tail>;
(EOF (e.BeginLine e.BeginCol) e.Lex (e.EndLine e.EndCal)) = e.Lex;
}
Preprocessor {
}