clear()
/* free up allocated memory, reset counters for next Expr */
{
struct node * ptr;
while (tlist) {
ptr = tlist->next;
free(tlist);
tlist = ptr;
}
temp = 0;
}
atom (char * operation, char * operand1, char * operand2,
char * result)
/* put out an atom. */
{
if (operand2) /* NEG has only one operand and result */
printf("%\t%s %s %s %s\n", operation, operand1, operand2, result);
else
printf("%\t%s %s %s\n", operation, operand1, result);
}
$ ./miniC
(a+b)*c
ADD a b T0
MUL T0 c T1
-a+b*c
NEG a T0
MUL b c T1
ADD T0 T1 T2
^D