Programming languages Q
Q1) what is byte code and why java is portability?
Q2) Define structured programming.
Q3) Define the polymorphism with example.
Q4) Draw a block diagram of jit compiler?
Q5) 6.Using the grammar in Example 3.2, show a parse tree and a leftmost
derivation for each of the following statements:
a. A = A * (B + (C * A))
b. B = C * (A * C + B)
c. A = A * (B + (C))
grammar in Example 3.2
<assign> → <id> = <expr>
<id> → A|B|C
<expr> → <id> + <expr>
| <id> * <expr>
|( <expr> )
| <id>
Q6) 7. Using the grammar in Example 3.4, show a parse tree and a rightmost
derivation for each of the following statements:
a. A = (A + B) * C
b. A = B + C + A
c. A = A * (B + C)
d. A = B * (C * (A + B))
grammar in Example 3.4
<assign> →<id> = <expr>
<id> →A | B | C
<expr> →<expr> + <term>
| <term>
<term> →<term> * <factor>
| <factor>
<factor> →( <expr> )
| <id>
Q7) 3. Rewrite the BNF of Example 3.4 to give + precedence over * and force +
to be right associative.
Q8) 13. Write a grammar for the language consisting of strings that have n
copies of the letter a followed by the same number of copies of the
letter b, where n > 0. For example, the strings ab, aaaabbbb, and
aaaaaaaabbbbbbbb are in the language but a, abb, ba, and aaabb are not.