Hi guys,

I am want to do three address code generation after having parsed syntax 
rules.

Generally, semantic rules are defined as for example:

  S ->  if E then S1           Semantic rule:   E.true := newlabel;   
E.false := S.next;    S1.next := S.next;   S.code := E.code || 
gen(E.true ':') || S1.code

E ->  id1relop id2          Semantic rule:   E.code := gen( 'if' 
id1.place relop.op id2.place 'goto' E.true) || gen( 'goto' E.false )


My problem is that I don't  know yet how to integrate such semantic 
rules in the Transform class, as I assume that should be the place where 
those semantic rules
should be defined.

I hope that anyone can give me a clue how to start implementing the 
semantic rules.

Many thanks in advance,

Thiel

Reply via email to