(8) (3 marks) Write BNF grammar rules for a language that is comprised only of sentences described as follows: symbol,...
(8) (3 marks) Write BNF grammar rules for a language that is comprised only of sentences described as follows: symbol, fol symbols orjust onéx symbol, A sequence of one or more occurrences of an a lowed by either zero or morez followed by a sequence of one or more b symbols. (9) (1 mark) The following fragment of grammar describes the syntax of the exponentiation operator. What is the associativity ot the operator as detined here? factor | expr factor expr (10) (1 mark) What are derivation order do they attempt to construct for the sentence being parsed? the two major styles of parser? In each case, what (11) (1 mark) Name a variable attribute which is bound at (a) compile time (b) link time (c) run time (12) (1 mark) Define what is meant by the lifetime of a variable. (13) (1mark) Describe one of the common programming errors which can arise when using pointers. (14) (2 marks) Consider the array x: Ita double occupies 8 bytes, and accessis in row major order, what is the byte ottset (the number of bytes from the beginning of the array, starting trom zero) ot the element x[7,6]? array [0..10, 5..10] of double (15) (1 mark) What advantage is gained by providing ser-located loop control statements in a programming language? (16) (2 marks) Using an example, explain how operand evaluation order can attect the result of expression evaluation when a functional side ettect is present
(8) (3 marks) Write BNF grammar rules for a language that is comprised only of sentences described as follows: symbol, fol symbols orjust onéx symbol, A sequence of one or more occurrences of an a lowed by either zero or morez followed by a sequence of one or more b symbols. (9) (1 mark) The following fragment of grammar describes the syntax of the exponentiation operator. What is the associativity ot the operator as detined here? factor | expr factor expr (10) (1 mark) What are derivation order do they attempt to construct for the sentence being parsed? the two major styles of parser? In each case, what (11) (1 mark) Name a variable attribute which is bound at (a) compile time (b) link time (c) run time (12) (1 mark) Define what is meant by the lifetime of a variable. (13) (1mark) Describe one of the common programming errors which can arise when using pointers. (14) (2 marks) Consider the array x: Ita double occupies 8 bytes, and accessis in row major order, what is the byte ottset (the number of bytes from the beginning of the array, starting trom zero) ot the element x[7,6]? array [0..10, 5..10] of double (15) (1 mark) What advantage is gained by providing ser-located loop control statements in a programming language? (16) (2 marks) Using an example, explain how operand evaluation order can attect the result of expression evaluation when a functional side ettect is present