1) Can you have multiple items on the left or right side of a Post
production? That is to say, can you have an event that is a mouse click
and a question asking where the mouse was clicked and determine your
result based on both items taken together? If so, what is the notation
for this?
2) Similarly for output: Can you have multiple actions performed on
output? How does the notation work?
3) Can you have parameters to side effects? For example, in the
assignment, we are asked to change something as a side effect of a
production. Can we say ChangeX(var)> to change X to var as a side effect?
4) I'm still somewhat confused as to what "Program Inputs" are and how
"The System" is defined.
5) Are there any good examples of Post production systems on the
interblag that anyone has found?
It would be nice to have been given this information in the lecture
slides...the lecture slides on this topic seem to be lacking on this
topic...and given the way the midterms have been, this worries me very
very much looking to the final...
x -> !command
which is triggered whenever a state becomes x?
Lyle Waldman wrote:
> 2) Are we allowed productions that do not have an action on the left side?
1) Are we allowed alternation (e.g. a rule that says *action, State,
(State1 | State2 | State3) that triggers on action if State and any of
State1, State2, or State3 are true?
2) Are we allowed productions that do not have an action on the left side?
No. This would be done as three rules:
*event, state1 ==>
*event, state2 ==>
*event, state3 ==>
> 2) Are we allowed productions that do not have an action on the left side?
Actions and side effects appear only on the right.
Events, queries, and program inputs appear only on the left.
State variables can appear on either side.
Byron
--
---------------------------------------------------------
Byron Weber Becker Voice: 519-888-4567 x34661
School of Computer Science Fax: 519-885-1208
University of Waterloo Office: DC3105
Waterloo, ON N2L 3G1
> That is to say, can you have an event that is a mouse click
> and a question asking where the mouse was clicked and determine your
> result based on both items taken together?
Absolutely, provided you have definitions for both. Good definitions of
your terms are critical.
> If so, what is the notation
> for this?
Something like:
Definitions:
Events
Mouse{*mouseDown, *mouseUp} // Mouse button pressed down event
(more detail would probably be good; also need documentation for *mouseUp
Queries:
location{?TopLeft, ?TopRight, ?BottomLeft, ?BottomRight} //
appropriate documentation. Assume each query returns true or false
Productions:
*mouseDown, ?TopLeft ==> (put your actions here)
Please Note: There are many ways to do this. This example builds off
of Lyle's question and is not meant to be taken as THE way to do it
> 2) Similarly for output: Can you have multiple actions performed on
> output? How does the notation work?
Yes. List all the actions you want to have happen if/when the rule fires.
> 3) Can you have parameters to side effects? For example, in the
> assignment, we are asked to change something as a side effect of a
> production. Can we say ChangeX(var)> to change X to var as a side effect?
That would typically be done with a state variable (documented in
definitions section) named X and then simply say
???? ==> X = var
Please be careful with variables. They should behave more like
enumerations - ie: a small set of possible values
> 4) I'm still somewhat confused as to what "Program Inputs" are and how
> "The System" is defined.
Program inputs are not that common for what we're doing. Think of them
as inputs to the program that don't originate with the user. For example,
>NetworkIsNowConnected //used to determine when to enable...
>
> 5) Are there any good examples of Post production systems on the
> interblag that anyone has found?
The textbook has an entire chapter mostly devoted to the topic with more
examples in the following chapter.
> It would be nice to have been given this information in the lecture
> slides...the lecture slides on this topic seem to be lacking on this
> topic...and given the way the midterms have been, this worries me very
> very much looking to the final...
Some things lend themselves to actual demonstrations/interactive
presentation. I thought this was one of them.
>
> x -> !command
>
> which is triggered whenever a state becomes x?
Assuming x is a state variable, it can have one of a limited set of
values -- like an enumeration in Java. You should specify which of
those it has:
Location == INSIDE --> !command
If the variable is boolean valued, then just stating it, like you did,
is fine.
"The component produces a total of 6 messages plus the null message.
These should be viewed as side-effects of the component (internally,
it's updating listeners, one of which is code that displays the text in
a JLabel)."
As such, it seems that changing the string to be printed is a side
effect, meaning I would need to write a side effect to do it. If it's
allowed to be done as a state variable change, I think it would probably
be cleaner. Or perhaps I'm misunderstanding the spec.
Yes, you may use parameters provided they are appropriately documented.
I didn't show any examples in class that used them, but Olsen allows them.
In class we spoke of informal language vs. formal language. You're
definitely sliding the balance towards the informal language. That's OK
(to a point) but does put an additional burden on your definitions and
the documentation of them.
Byron