1. There are many possible answers to this question. Here are possibilities in Pascal: Lexical error: `@' sign outside of a string or comment. Syntax error: mismatched parentheses in an arithmetic expression. Static semantic error: use of an identifier that was never declared. Dynamic semantic error: attempt to access an element beyond the bounds of an array. Error that can't reasonably be caught: modification of the index of a for loop by a subroutine called from within the loop. 2. Compiled code usually runs significantly faster than interpreted code, so programmers interested in performance tend to demand compilers, even for languages like Lisp. Compilation also catches some errors earlier, when they are easier to fix, rather than waiting to detect them until the program actually runs. Interpretation definitely has its advantages, however; it is not just a last resort. It is very handy during development because it allows a newly modified program to be executed without waiting for potentially time-consuming compilation and linking steps. It may be desirable on small machines because it takes less space, both in memory when running and on disk (because there are no executables). Interpretation facilitates higher quality error messages, because the interpreter has access to the full program source. It is much easier to bootstrap or port an interpreter than a compiler, so experimental language implementations are very often based on interpreters. 3. a. The scanner. b. The parser. c. The constrainer d. Depends on the language implementation. If library functions are analyzed at compile time, then the constrainer (through the symbol table) would catch the error. Quite often, however, the errors is caught at link time, when external references (such as references to library functions) are resolved. e. Depends on whether the value of the divisor can be calculated at compile time, e.g. the expression n/0. Here, the static semantics analyzer could catch the error. However, if the divisor can't be calculated until run time, then the compiler cannot catch it at all. 4. E / \ / | \ E + T | / | \ T F / T | | | F P F | / | \ | P ( E ) P | / | \ | i E + T i | | T F / | \ | F * T P | | | P F i | | i P | i 5. Stack Input Production Chosen ------------------------------------------- S bbbddd| S->A A bbbddd| A->bAd bAd bbbddd| Ad bbddd| A->bAd bAdd bbddd| Add bddd| A->bAd bAddd bddd| Addd ddd| A-> ddd ddd| dd dd| d d| - | -------------------------------------------