These are sample questions. I will add more as the week progresses.
  1. What is the character set of C? What is the character set of Java? Which part of the compiler will be influenced by these?
  2. Write a regular expression whose language is all strings over a,b and whose length is a multiple of 3.
  3. Define Java comments using Lex.
  4. A gloating point number is one with at least a digit in the whole part and at least a digit in the fractional part. Define a regular expression for it.
  5. What is the edit distance between strings aabbbaaa abbaaaab?
  6. Write down FIRST and FOLLOW of S--> a S b | ab
  7. Is the above grammar LR(0)? Is it LR(k) for any k?
  8. S --> a S | epsilon. Is this grammar LR(0)? Is it LR(k) for any k?
  9. Explain briefly how the LL(1) parser works?
  10. Remove immediate left recursions from A --> A b | c A | B d | e
  11. What is the language produced by the grammar S --> a S a | b S b | c?
  12. The grammar for regular expressions is: 1) E --> E | T 2) E--> T 3) T --> T F 4) T --> F 5) F --> ( E ) 6) F --> i 7) F --> F * Construct the SLR table
  13. Construct the SLR table 1) S --> E = E 2) S --> i 3) E --> E + i 4) E --> i. Note where the reduce/reduce action conflict occurs.
  14. Write a syntax directed translation scheme to count the nesting of if statements.
  15. Repeat the above problem for while statements.
  16. What is the type of int a[][];
  17. What is the type of int foo(int a, Double b, int[] c);
  18. Unify the expressions f(g(a,b),c) and f(e,g(a,b))
  19. What is the type of the following method: fun sum x x = f x end;
  20. Find the basic blocks of x = 0; while (x < 10) { x=x+1;}
  21. Generate byte code (assembler format is fine) for the following block: int sum, a[]; a= new int(10);sum = 0; for(i=0;i<10;i++) sum = sum+a[i];
  22. Generate bytecode for x=90; if (a < b) x=x+y; else x=x-y; you can assume all the variables are integers.