Write a regular expression that captures the set of strings composed of 'a', 'b', and 'c',...
1. L is the set of strings over {a, b) that begin with a and do not contain the substring bb. a. Show L is regular by giving a regular expression that denotes the language. b. Show L is regular by giving a DETERMINISTIC finite automaton that recognizes the language.
31. Scanner Construction (10 pts) Construct a regular expression for recognizing all non-em and b that do not end in b. a) pty strings gs composed of the letters b) Convert the regular expression to an NF c) Convert the NFA to a DFA (show the sets of NFA states for each DFA state).
1. Write regular expressions to capture the following regular languages: (a) The set of binary strings which have a 1 in every even position. (Note: odd positions may be either 0 or 1.) (b) The set of binary strings that do not contain 011 as a substring. (c) Comments in Pascal. These are delimited by (* and *) or by { and }, and can contain anything in between; they are NOT allowed to nest, however. 2. Write a DFA...
1. Give a regular expression for the set of strings over {a, b, c} such that the sum of the number of a’s and the number of b’s is equal to 3.
Programming Languages Final Exam Name: Question 1 (15 points) Give a regular expression for each of the following languages over = {0,1,2). 1. All strings that begin with 1 and end with 2. 2. All strings that contain exactly three 1's. For example, "0101012" is valid. 3. All strings in which the digits are non-decreasing. For example, "002" is valid, but "102" is not.
Suppose the alphabet is sigma = {a, b, ..., z, 0, 1, ..., 9,: }, i.e., the standard letters a-z, decimal numbers, and colon (: ). The colon is used as a delimiter between fields in a text file. Each line of the file thus corresponds to a string. a) Give a regular expression that accepts strings with four fields (i.e., with 3 delimiters). b) Give a regular expression that accepts strings where the second field is numerical. c) Give...
1. Consider the alphabet {a,b,c}. Construct a finite automaton that accepts the language described by the following regular expression. 6* (ab U bc)(aa)* ccb* Which of the following strings are in the language: bccc, babbcaacc, cbcaaaaccbb, and bbbbaaaaccccbbb (Give reasons for why the string are or are not in the language). 2. Let G be a context free grammar in Chomsky normal form. Let w be a string produced by that grammar with W = n 1. Prove that the...
1. Find expressions for each of the following. (Leave your answer as a mathematical expression rather than a number.) (a) The number of strings of 8 lower case letters (a-z) that do not contain any letter more than once. (b) The number of binary strings of length 10 that contain at most two Os. (c) The number of subsets of 11,2,,10 with three elements that contain at least one even number and at least one odd number. [Give brief justifications.]...
Construct context-free grammars that generate the given set of strings. If the grammar has more than one variable, we will ask to write a sentence describing what sets of strings expect each variable in the grammar to generate. For example, if the grammar was: I could say "C generates binary strings of length one, E generates (non-empty) even length binary strings, and O generates odd length binary strings." It is also fine to use a regular expression, rather than English,...
For each of the languages listed below, give a regular expression that generates the lan- guage. Briefly justify your answer. (a) The set of strings over (a, b such that any a in the string is followed by an odd number of b's. Examples: bbbab E L, but abb f L. (b) The set of strings over fa, b in which there is an a in every even position and the total number of b's is odd, where the first...