Question: Consider a language that allows nested functions. Use the following stack contents to answer the following true/false questions. A) sub4 is nested/defined in sub1. TRUE/FALSE.
-
Consider a language that allows nested functions. Use the following stack contents to answer the following true/false questions. A) sub4 is nested/defined in sub1. TRUE/FALSE. Justify your answer.
B) sub2 has access to variables in main. TRUE/FALSE. Justify your answer.
-
(20 points) Study the Java BNF to ensure that you understand the notational conventions used in that BNF. Now, use those notational conventions to write a concise rule to capture the following syntax. That is, write BNF rules that could be added to the given BNF
-
-
With respect to Java, identify the strings that match the given grammar rule.
| Java Grammar Rule | Strings | Yes/No |
| | 0x8 | |
| x0 | ||
| 0x34eE | ||
| FE00 | ||
| | .55 | |
| 55. | ||
| 0.0 | ||
| 0.0d | ||
| .E22 | ||
| 1.0+E10 | ||
| 1.0E+2f | ||
| 1.0e2f | ||
| 1.0e00f |
-
(20 points) With respect to the Java grammar, answer the following questions:
-
Determine the shortest possible
. -
You do not need to provide a derivation. Just provide the final string.
-
-
Do import statements have to appear at the top of a Java program? Justify your answer using the grammar.
-
-
(10 points) Use the virtual machine instructions given in Chapter 3. Write the operational semantic definition of Javas do-while.
-
(10 points) Compute the weakest precondition for:
{ fill this in }
if (x > y) y = 2 * x + 1; else y = 3 * x - 1; { y > 3 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
