Suppose you were modifying the Java compiler to include a new encryptedd
keyword that causes Java to store the contents of the specified variable in encrypted form.
E.g.,
encrypted String password = “hello”;
would cause the contents of password to be encrypted.
Which of the phases of the Java compiler would need to be modified and why?
2. For each of the following languages give the regular expression that matches the strings in
the language. Note: You can use . to denote “any” character in the alphabet.
(a) [5 marks] The language, over the English alphabet, of strings that begin and end with
vowels (assume ’y’ is a vowel).
(b) [5 marks] The language of strings, over alphabet Σ = {x,y,z}, whose length is divisible
by 5. E.g., xyzyx.
(c) [5 marks] The language, over the alphabet of decimal digits, of strings that represent
integers divisible by 200. E.g., 13400.
(d) [5 marks] The language of strings over the alphabet Σ = {a,b,c} that do not contain
the substring ac. E.g., abcab.
3. For each of the following languages, give a DFA (graphical representation) that recognizes
the language.
(a) [5 marks] The language of all strings over the alphabet Σ = {x,y,z} that end in either
xx or yy. E.g., xyzyxzxx.
(b) [5 marks] The language of words over the alphabet Σ = {a}, whose length is not
divisible by 4. E.g., aaa.
(c) [5 marks] The language, of trinary strings (Σ = {0,1,2}) such that the sum of the
digits is divisible by 3. E.g., 012102.
please don’t copy answers from Chegg,thx.


0 comments