Compiler Design: Assignment: S S L L A L S
Compiler Design: Assignment: S S L L A L S
1) In the following, a number-string is a non-empty sequence of decimal digits, i.e., something in the
language defined by the regular expression [0-9]+. The value of a number-string is the usual interpretation
of a number-string as an integer number. Note that leading zeroes are allowed. Make for each of the
following languages a regular expression that describes that language.
a) All number-strings that have the value 42.
c) All number-strings that have a value that is strictly greater than 42.
2) Construct Transition diagrams for each of the following regular languages. In all cases the alphabet is
{a, b}.
a) The set of strings that has exactly 3 bs (and any number of as).
b) The set of strings where the number of bs is a multiple of 3 (and there can be any number of as).
5) Calculate Nullable, FIRST and FOLLOW for the nonterminals A and B in the grammar
A→ BAa
A→ε
B → bBc
B → AA
6) Consider the context-free grammar S SS | SS *| a
S ( L )| a
L L,S |S