Commit 2c862ae20a6453b0d851e4abfa322ac0794839d0

Authored by Salvador Abreu
1 parent 51e810c0
Exists in master

variables with an initializer (constants) are now replaced by their value

Showing 1 changed file with 8 additions and 1 deletions   Show diff stats
fz/semantic.pl
... ... @@ -39,9 +39,16 @@ sa_n_traverse(N, NN, ST) :- sa_n(N, NN, ST). % non-list case
39 39 % id(N) - Name -- identifier
40 40 % constraint(C,A) - Constraint, Attrib -- constraint
41 41 %
  42 +% variables with an initializer are treated as SSA & will now stand for
  43 +% the literal in the initializer itself.
42 44  
43   -sa_n(var(N,T,I,A), V, ST) :-
  45 +sa_n(var(N,T,[],A), V, ST) :- !,
44 46 sa_attribs(A, AX, ST),
  47 + V=var(N,T,[],AX), % new AST node becomes ST entry value
  48 + st_insert(ST, N, V).
  49 +
  50 +sa_n(var(N,T,I,A), NI, ST) :- % non-empty initializer
  51 + sa_attribs(A, AX, ST), % should ignore this?
45 52 sa_n_traverse(I, NI, ST), % parse initializer
46 53 V=var(N,T,NI,AX), % new AST node becomes ST entry value
47 54 st_insert(ST, N, V).
... ...