State whether or not each of the following language constructs is syntactically
ID: 3870328 • Letter: S
Question
State whether or not each of the following language constructs is syntactically valid. For each invalid construct, give the number of the syntax rule that is violated.
Use the EBNF description of Modula-2 language below question (c) and (d) to answer
(c) Compilation unit: DEFINITION MODULE VectorOperationsi TYPE Vector; PROCEDURE Create (x, y, z: REAL) PROCEDURE Assign ( PROCEDURE Equal (v, w: Vector): PROCEDURE GetX (v Vector): REAL; PROCEDURE GetY (v: Vector) REAL PROCEDURE GetZ (v: Vector): REAL PROCEDURE Add (v, w: Vector; VAR sum: Vector); : Vector; v: Vector; VAR w: Vector); END VectorOps (d) Declaration: VAR currentSize: [0. .bufferSize]; nonfuII, nonempty: SIGNAL; in, out: [0. .bufferSize-1] buffer ARRAY 0..bufferSize-1 OF CHAR;Explanation / Answer
ANSWER
C)
It is invalid syntax as with the description in ebnf of module 2.
As it violated the 1.2 rule of module 2 ebnf.
D)
It is invalid syntax as with the description in ebnf of module 2.
As it violated the 2.4 rule of module 2 ebnf.
THANK YOU
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.