Section 2
week 1
1 Write a program in NUT language to perform adding two arrays.
Let A, B, C be arrays of size N (such as 100), we want to do C = A + B.
1.1 Write an iterative version (using
"while" and array access).
1.2 Write a recursive version.
read Programming Recursion
for a guidance.
2 Try those two programs using NUT compiler and virtual
machine. Write down your experience, opinions, comments etc.
week 2
1 Modify the scanner "lex.txt" to accept "+"
as a special symbol, when it scans an input "1+2", the output should be
"1", "+", "2".
2 Draw a "rail-road" diagram of Nut grammar shown in my book chapter 2.