Question 1: Tokenizing source code [6]

Suppose we have a compiler for lisp and a compiler for C, and each of them use a two-stage compilation process:

(i) Pick one of the two programs below (one program is in lisp and the other is in C) and identify what an appropriate list of tokens would be and why.

(defvar y 'y)(defvar x y)(defvar |x y| (list 'x 'y))
(format t "~A~A~A~%" X Y |x y|)
int f(int y0){ return (y0+++2); }
int g()
{
   int x3 = 45;
   int y,_z=x3+=6;
   return f(y)&&++_z;
}
int main(){ return f(g(0)); }

(ii) If you chose the C program in part (i), show the value returned by the main routine in the C program and briefly explain your answer. If you chose the lisp program in part (i), show the output that would be produced by the program and briefly explain your answer. (Both programs do compile cleanly.)