CSC 216/s08/seek reconciliation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
[http://meta.wikimedia.org/wiki/Help:Wikitext_examples Formatting Help Guide from MetaWiki]
[http://meta.wikimedia.org/wiki/Help:Wikitext_examples Formatting Help Guide from MetaWiki]


==Place Title of Exercise Here==
==Finite State Machines==
<br>
<br>
 
[[Image:fsm.jpg]]
 
<br>
<br>
 
Link to powerpoint : http://www4.ncsu.edu/~ajbertol/FiniteStateMachines.pptx
 
<br>
<br>
 
==Floating Point FSM Exercise==


Give the title of your exercise, which may include the name of the topic you are covering, or some other catchy title.


===The problem===
===The problem===


Describe what you are attempting to teach students by this exercise.
The exercise will illustrate the "State" programming paradigm through the floating point parser finite state machine discussed in class.  


===Participants and props===
===Participants and props===


How many students will participate? What else do you need (e.g., old tennis ball, Powerpoint slides, software).
4 students will participate. 3 for each "State" (Start, Decimal, Integer) and one to represent the "parser."  The parser will have a piece of paper with the numbers to be parsed on it, with space in between the numbers to write the output.  Each person representing a state will hold up a piece of paper.  On the front will be the name of that person's state.  On the back will be the actions to perform based on the input given by the parser. Here are the instructions:
 
====Start====
 
Plus: sign is positive; GOTO Integer
 
Minus: sign is negative; GOTO Integer
 
Decimal: sign is positive; write decimal; GOTO Decimal
 
Digit: sign is positive; add digit; GOTO Integer
 
Other: Error
 
====Decimal====
 
Plus: Error
 
Minus: Error
 
Decimal: Error
 
Digit: add digit; GOTO Decimal
 
Other: Error
 
====Integer====
 
Plus: Error
 
Minus: Error
 
Decimal: add digit; write decimal; GOTO Decimal
 
Digit: add digit; GOTO Integer
 
Other: Error
 
NOTE: adding a digit means writing it in the next decimal place


===The script===
===The script===


Describe how to do your exercise.
The "parser" will start at the "Start" state.  The "parser" will tell the state what the first character of the input is, being either a "plus", "minus", "decimal", "digit", or "other".  The state will tell the "parser" to perform the action stated on the back of their sheet.  This continues until either the "parser" reaches the end of the number or if an error occurs.  Repeat for different cases.

Latest revision as of 04:07, 21 April 2008

Formatting Resources

Formatting Help Guide from MetaWiki

Finite State Machines





Link to powerpoint : http://www4.ncsu.edu/~ajbertol/FiniteStateMachines.pptx



Floating Point FSM Exercise

The problem

The exercise will illustrate the "State" programming paradigm through the floating point parser finite state machine discussed in class.

Participants and props

4 students will participate. 3 for each "State" (Start, Decimal, Integer) and one to represent the "parser." The parser will have a piece of paper with the numbers to be parsed on it, with space in between the numbers to write the output. Each person representing a state will hold up a piece of paper. On the front will be the name of that person's state. On the back will be the actions to perform based on the input given by the parser. Here are the instructions:

Start

Plus: sign is positive; GOTO Integer

Minus: sign is negative; GOTO Integer

Decimal: sign is positive; write decimal; GOTO Decimal

Digit: sign is positive; add digit; GOTO Integer

Other: Error

Decimal

Plus: Error

Minus: Error

Decimal: Error

Digit: add digit; GOTO Decimal

Other: Error

Integer

Plus: Error

Minus: Error

Decimal: add digit; write decimal; GOTO Decimal

Digit: add digit; GOTO Integer

Other: Error

NOTE: adding a digit means writing it in the next decimal place

The script

The "parser" will start at the "Start" state. The "parser" will tell the state what the first character of the input is, being either a "plus", "minus", "decimal", "digit", or "other". The state will tell the "parser" to perform the action stated on the back of their sheet. This continues until either the "parser" reaches the end of the number or if an error occurs. Repeat for different cases.