Extend the Funclang language to add array of numeric values as a new kind of value to
Question:
Extend the Funclang language to add array of numeric values as a new kind of value to the programming language. This would require adding three new kinds of expressions, arrayexp, indexexp, and assignexp. You will also need to generalize the array allocation and access operations for heap from the previous question.
To create an array with three rows, one can use arrayexp as follows:
In the output, we have adjusted spacing for clarity, but you are simply required to produce output that is equal to these.
To create an array with three rows and four columns, one can use arrayexp as follows:
To create a three-dimensional array with three rows, four columns, and height two, one can use arrayexp as follows:
To access the second element in an array with three rows, one can use indexexp as follows:
To access the element in the second row and the first column in an array with three rows and four columns, one can use indexexp as follows:
To assign the second element in an array with three rows, one can use assignexp as follows:
To assign the element in the second row and the first column in an array with three rows and four columns, one can use indexexp as follows:
Step by Step Answer:
An Experiential Introduction To Principles Of Programming Languages
ISBN: 9780262045452
1st Edition
Authors: Hridesh Rajan