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
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
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.
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
&...
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>...
Recursive Descent Parsing Consider the following BNF grammar: A -> I = E E -> P O P | P O -> + | - | * | / | ** P -> I | L | UI | UL | (E) U -> + | - | ! I -> C | CI C -> a | b | ... | y | z L -> D | DL D -> 0 | 1 | ... | 8 |...
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...
NEED THIS SOON. Recursive Descent Parsing Consider the following BNF grammar: A -> I = E E -> P O P | P O -> + | - | * | / | ** P -> I | L | UI | UL | (E) U -> + | - | ! I -> C | CI C -> a | b | ... | y | z L -> D | DL D -> 0 | 1 | ......
You are given the following context free grammar in BNF format. 1 <expression> ::= <term> | <expression> "+" <term> 2 <term> ::= <factor> | <term> "*" <factor> 3 <factor> ::= <constant> | <variable> | "(" <expression> ")" 4 <variable> ::= "x" | "y" | "z" 5 <constant> ::= <digit> | <digit> <constant> 6 <digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" a) Show how the expression 4...