Chapter 3:Lexical Analysis

Notation ....

. Precedence and associativity

. *, concatenation, and | are left associative

. * has the highest precedence

. Concatenation has the second highest precedence

. | has the lowest precedence

Unnecessary parentheses can be avoided in regular expressions if we adopt the conventions that:

. The unary operator * has the highest precedence and is left associative.

. Concatenation has the second highest precedence and is left associative.

. | has the lowest precedence and is left associative. Under these conventions, (a)|((b)*(c)) is equivalent to a|b*c. Both expressions denote the set of strings that are either a single a or zero or more b 's followed by one c .