1
2
3
4
5
6
7
8
9
10
11 expand_prefix: proc(blk,stmnt,tree,context) returns(ptr);
12
13 dcl (blk,stmnt,tree,a) ptr;
14 dcl opcode bit(9) aligned;
15 dcl n fixed bin(15);
16 dcl (string,null) builtin;
17
18 %include semant;
19
20 %include operator;
21 %include semantic_bits;
22
23 %include op_codes;
24
25 %include nodes;
26
27
28 this_context = "0"b;
29 def_this_context.by_name_assignment = def_context.by_name_assignment;
30
31 a = tree->operator.operand(2);
32 opcode = tree->operator.op_code;
33 if a->node.type = reference_node
34 then a = expand_primitive(blk,stmnt,a,this_context);
35 else if a->node.type = operator_node
36 then if a->operator.op_code = std_call
37 then a = expand_primitive(blk,stmnt,(a->operator.operand(1)),"0"b);
38 call apply_prefix(a);
39 return(a);
40
41
42
43 apply_prefix: proc(e);
44
45 dcl (p,e,t) ptr;
46 dcl n fixed bin(15);
47
48 if e->node.type = operator_node
49 then do;
50 if e->operator.op_code = loop
51 then do;
52 t = e->operand(1);
53 call apply_prefix(t);
54 e->operand(1) = t;
55 return;
56 end;
57 if e->operator.op_code = join
58 then do;
59 do n = 1 to e->operator.number;
60 t = e->operand(n);
61 call apply_prefix(t);
62 e->operand(n) = t;
63 end;
64 return;
65 end;
66 end;
67 p = create_operator(opcode,2);
68 p->operator.operand(2) = e;
69 e = p;
70 e = operator_semantics(blk,stmnt,e,"0"b);
71 return;
72 end apply_prefix;
73
74 end expand_prefix;