Compiler Design compiler parser LL(1) Parsers

A top-down parser that uses a one-token lookahead. The first L indicates that the input is read from left to right. The second L says that it produces a left-to-right derivation. And the 1 says that it uses one lookahead token. (Some parsers look ahead at the next 2 tokens, or even more than that.)


A grammar G is ambiguous if some sentence in L( G) has more than one rightmost (or leftmost) derivation.


This is the (0), (1), (k) or (*)-syntax you see after the names of these two general algorithms, such as LR(1) or LL(k). k usually stands for 'as much as your grammar needs', while * usually stands for 'this parser performs backtracking', which is more powerful/easy to implement, but has a much higher memory and time usage than a parser that can just keep on parsing linearly.

Error Handling Error Recovery

The basic requirement for the compiler is to simply stop and issue a message, and cease compilation.

Panic mode recovery The parser discards the input symbol one at a time until one of the designated (like end, semicolon) set of synchronizing tokens is found. Mistakes to Avoid Null Pointers

Parser Unfriendly Syntax

Parsers should preferably be LL(1)

Unclear Semantics Bad Unicode Support Dangling else