(name printed) ___________________________________________________________
Hand in the paper to my mailbox or office. In the paper you write, make sure you explicitly state for the problems with program parts something like "emailed attached program p1a.txt" or whatever (see special ML instructions following) so I will know to look for it and that you did not overlook the problem. There may well be other explanatory information needed for the program parts as well.
I wish to add to this language 3 new features:
(1) normal For loop
Syntax: for I = 1 to N do E
Informal semantics: well known, I have no surprises in mind.
If N is < 1, then go through the loop zero times.
If N is = 1, then go through the loop one time.
(2) funky loop
Syntax: loop E1, B, E2 end
Informal semantics: B is an expression that is meant to evaluate to true or false;
the loop body is entered, and E1 is evaluated; then B is evaluated, and if
true E2 is also evaluated and the loop goes back for another iteration;
however, if B evaluates to false, then looping ends and E2 is not evaluated
on that last time thorugh. This loop can implement both traditional while loops
(E1 a null experssion), repeat loops (E2 a null expression), and hybrids.
(3) 2-way multi-assignment
Syntax: L1, L2 := E1, E2
Semantics: right-side expressions are all evaluated first,
then assignments to left-side L-values are done in the
order written.
This is allowed: x, x := 2, 7 and would result in x having
the value 7 when done.
Modify the denotational definition by adding formal semantics for
these three language features. You will need to add
the syntactic BNF, the semantic functions, and the semantic
equations that work off the BNF you create.
Syntax: L1, L2, ... Ln := E1, E2, ... En
Semantics: right-side expressions are all evaluated first,
then assignments to left-side L-values are done in some order;
shown here in left to right order.
Show an extenstion to the denotational definition from the previous question
that defines the meaning of this n-way multiassignment. You can pick how you
would want the order of assignment to go... you might, for example, find it
easier to write a definition if assignment were "inside out", like this
Syntax: L1, L2, ... Ln := En ..., E2, E1
It's your choice... pick your semantics, and formally define them. Make sure to tell
me informally what you are trying to define.
In designing this system you, of course, want to use the best software engineering techniques to ensure that the final product is nicely extensible and easily maintainable. Your client is a growing company, so while they sell mostly books on-line right now, they expect to expand their product lines into CDs, videos, electronics, software... whatever the market seems to support. Your system must be designed to allow this expansion without business interruption.
Sketch out a basic design for this system. Feel free to add your own details and enhancements to the (admittedly) very loose requirements given above.
In your design description explain what object-oriented design patterns you have used, and why. To give a complete answer, you should not simply name the patterns, but rather for each pattern you choose to use, explain briefly what its structure is and give a rationale for using it in this design. Explain how your use of particular patterns will help reach your goals of an extensible and maintainable system.