Compiler-Sec3 4 PDF
Compiler-Sec3 4 PDF
Engineering Faculty
Department of Computer Engineering
ECOM 5060: Compiler Design Discussion
Chapter 3
Lexical Analysis
(Section 3.4)
March, 2014
2 Computer Architecture Discussion
a) a(a|b)*a
b) ((|a)b*)*
c) (a|b)*a(a|b)(a|b)
d) a*ba*ba*ba*
3 Computer Architecture Discussion
a) All strings of lowercase letters that contain the five vowels (a, e, i, o, or u) in order.
b) All strings of lowercase letters in which the letters in are in ascending lexicographic
order.
String a*b*c*d*…………z*
Character [a-zA-Z0-9]
Comment /* (Character|“*/”|(*|/) Character)* */
4 Computer Architecture Discussion
h) All strings of a’s and b’s that do not contain the substring abb.
b* (a (|b))*
i) All strings of a’s and b’s that do not contain the subsequence abb.
b* a*(|b) a*
Best Wishes