Assignment 5, due Sept 29
Part of
the homework for 22C:50, Fall 2003
|
Implement the LOOP and ENDLOOP primitives suggested at the end of Chapter 6 of the notes. Boolean expressions shold be allowed (but optional) as operands on both the LOOP and ENDLOOP directives. If the expression on LOOP is present and evaluates to false, the loop will terminate. If the expression on ENDLOOP is present and true, the loop will terminate. Demonstrate your program with a loop that builds a table of the first 20 squares, using the recurrence relation that one squared is one and (n+1)2 is n2+n+n+1 (this allows you to generate a table of squares without the need to use a multiply operator, something that is missing from EAL).
Look up fseek() in the Unix programmer's reference manual (the on-line man command) or in The C Programming Language, Second Edition by Kernighan and Ritchie, and then describe how this primitive could be used in the implementation of the LOOP and ENDLOOP assembly directives illustrated in Figure 6.18.