-
Notifications
You must be signed in to change notification settings - Fork 1
/
STMT.PAS
65 lines (52 loc) · 1.48 KB
/
STMT.PAS
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
{ STMT.PAS
Description:
An "include unit" which contains the statement-type and case-pair
definitions.
}
unit stmt;
interface
uses linklist, expr;
type
stmt_kind = (COMPOUND, ST_EXPR, ST_IF, ST_CASE,
ST_FOR, ST_WHILE, ST_BREAK,
ST_CREATE, ST_DESTROY,
ST_WRITE, ST_WRITES, ST_STOP,
CONT_SEQ, END_SEQ);
stmt_ptr = ^stmt_type;
stmt_type =
record
case kind: stmt_kind of
COMPOUND:
(statements: list_type);
ST_EXPR:
(expression: expr_tree);
ST_IF: (
condition: expr_tree;
then_branch: stmt_ptr;
else_branch: stmt_ptr
);
ST_CASE: (
test_expr: expr_tree;
cases: list_type
);
ST_CREATE: (
archetype: integer; { direct pointer to Type_List }
new_name: expr_tree
);
ST_DESTROY:
(victim: expr_tree);
ST_FOR, ST_WHILE: (
selection: expr_tree;
action: stmt_ptr
);
ST_WRITE, ST_WRITES, ST_STOP:
(print_list: list_type);
end; { stmt_type }
case_pair_ptr = ^case_pair_type;
case_pair_type =
record
value: expr_tree;
action: stmt_ptr
end;
implementation { dummy implementation - must be here }
end. { unit stmt }