EXERCISES
- Why do we use separate Scanner and parser in a compiler? Can the parser not do both the jobs?
- Why in the Scanner shown in Section 3.2 the symbols like ‘=’ do not appear in the Symbol Table?
- Implement a lex based Scanner for the simple language discussed in Chapter 2. Compare it against the hand-coded C language implementation given there, in terms of the size of the programs and ease of developing the Scanner.
- Implement lex based Scanners for all the examples for regular expressions given in this chapter.
- If you are familiar with Perl or Python language, try to implement the Scanner for the simple language given in Chapter 2 in that language. Compare with the hand-coded C Scanner.
- Can you implement a compiler for a programming language ...
Get Compilers: Principles and Practice now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.