hw1.txt
, which looks like this:
Q1: answer for question #1 Q2: answer for question #2 …Turn it in via web checkin, or like this:
~cs200/bin/checkin HW1 hw1.txtDo not turn in a paper copy.
Given the following two grammars for matching brackets:
Q2: Show a derivation of [ ] [ ] [ ] using Grammar 1, starting with Alpha
Q3: Show a derivation of [ [ [ ] ] ] using Grammar 2, starting with Beta
Q4: Is [ ] [ ] produced by Grammar 2? (Y/N)
Q5: Is [ [ ] ] produced by Grammar 1? (Y/N)
Q6: Is [ [ ] ] produced by Grammar 2? (Y/N)
Complete the following table, keeping the operands in the same order. Use Java operator precedence.
Prefix expression | Infix expression | Postfix expression |
---|---|---|
/ - a b c | (a-b) / c | a b - c / |
Q7 | Q8 | a b c d + - * |
* % a b + c d | Q9 | Q10 |
Q11 | a + b * c | Q12 |
Q13 | true || true && false | true true false && || |
Q14 | a>=b || c<d | Q15 |