Consider the following BNF grammar:
S ::= A x | B y A ::= B y | C w B ::= x | B w C ::= y
Which of the following regular expressions describes the same set of strings as the grammar?
1. xwxy + xww∗y + ywx
2. xwx + xww∗y + yw
3. xw∗y + xwxyx + ywx
4. xwy + xw∗xyx + ywx
5. xw∗y + xw∗yx + ywx
6. none of the above
7. all of the above
Consider the following regular grammar with start symbol S and terminals {x, y}. S → xS S → yX S → yY X → xX X → yS Y → xY Y → λ List four strings, each of length less than 4, accepted by this grammar. (Include ε if it is accepted.) List four strings, each of length less than 4, not accepted by this grammar. (Include ε if it is not accepted.) In English, describe the language represented...
Question 1 Consider the following BNF grammar: Not complete Marked out of 3.00 p Flag question <letter> ::= "a" | "b" | "C" | "d" | "e" | "F" | "g" | "h" | "1" ";" | "K" | "1" | "m" | "n" | "0" | "p" | "q" | "r" | "S" | "t" || "u" | "V" | "W" | "x" | "y" | "z" <digit> ::= "O" | "1" | "2" | "3" | "4" |...
Consider the following BNF: Y ::= W S F | S M F | S M W ::= "d" | "j" | "f" S ::= "m" | "a" | "y" M ::= "y" | "n" | "u" | "g" F ::= "p" | "o" | "n" Write two strings that are valid according to the BNF. For each of your two strings, give two valid mutants of the string. For each of your two strings, give two invalid mutants of...
1. (15 pts) Consider the following BNF grammar: For each of the strings below, indicate whether or not the string can be derived from the grammar. ?f so, provide a derivation. (a) (5 pts) aabccd (b) (5 pts) accbcc (c) (5 pts) acccce
Exercise 24-3
Carlton Company is involved in four separate industries. The
following information is available for each of the four
industries.
Operating Segment
Total Revenue
Operating Profit (Loss)
Identifiable Assets
W
$60,000
$15,000
$167,000
X
10,000
3,000
83,000
Y
23,000
(2,000)
21,000
Z
9,000
1,000
19,000
$102,000
$17,000
$290,000
Determine which of the operating segments are reportable based on
the:
Reportable Segments
(a)
Revenue test.
WXYZW & XW & YW & ZX & YX & ZY & ZW, X
&...
1. Who are language descriptions intended for? Consider the following grammar: ab b | b a | a Which of the following sentences are in the language generated by this grammar? (DONE) a) baab ==> YES b) bbbab ==> NO c) bbaaaaaS ==> NO d) bbaab ==> YES 2. Write a BNF grammar for the language consisting of binary strings (any combination of 0s and 1s) of at least 2 digits.
3. Consider the following BNF for arithmetic expressions: <expression> ::= <term> <term>+ <expression> | <term> - <expression> <term> ::= <factor> | <factor> * <term> | <factor> I <term> <factor> ::= <constant> (<expression>) <constant ::= 0|1|2|3|4|5|6789 a) Show the expression tree of the following expression: 8/7*5/6-6/4/2-7*(5+2). b) Give the value of this expression. c) Same question as (a), if the BNF were <expression> ::= <term> | <expression>+ <term> | <expression> - <term> <term> ::= <factor> | <term>*<factor> | <term> / <factor>...
Solve the following questions. All questions are mandatory. Q1: What’s wrong in the following grammar? S → ABC A → aA|aa B → bB|B C → cC|cccc Q2: Describe the strings generated by the following grammar S → aSa S → bSb S → aa S → bb Q3: Consider the following grammar: S → ABC A → aA|a B → bB|b C → cC|c Change the above grammar such that it generates L1={anbmck; n>=3,m>=3,k>=4} Q4: Use the following grammar...
Transform the following left recursive BNF grammar into an equivalent non-left recursive grammar (S and A are nonterminal symbols; S is the start symbol; a and b are terminal symbols): S -> aSb | bAS A -> AaA | bAA | AAa | bAb CAUTION: Make sure ALL left recursion is eliminated.
Consider the following BNF grammar that we saw in class: EXP ::= EXP + TERM | EXP - TERM | TERM TERM ::= TERM * FACTOR | TERM / FACTOR | FACTOR FACTOR ::= ( EXP ) | DIGIT DIGIT ::= 0 | 1 | 2 | 3 (a) Translate into EBNF. (b) Draw syntax diagrams. (c) What are the two requirements on a grammar for a predictive parser to be able to...