CSC 216/s08/seek reconciliation: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
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==
==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===
Line 12: Line 11:
===Participants and props===
===Participants and props===


4 students will participate.  3 for each "State" (Start, Decimal, Integer) and one to represent the "parser."  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:
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====
====Start====


onPlus:
Plus: sign is positive; GOTO Integer


onMinus:
Minus: sign is negative; GOTO Integer


onDecimal:
Decimal: sign is positive; write decimal; GOTO Decimal


onInteger:
Digit: sign is positive; add digit; GOTO Integer
 
Other: Error


====Decimal====
====Decimal====


onPlus:
Plus: Error
 
Minus: Error


onMinus:
Decimal: Error


onDecimal:
Digit: add digit; GOTO Decimal


onInteger:
Other: Error


====Integer====
====Integer====


onPlus:
Plus: Error
 
Minus: Error
 
Decimal: add digit; write decimal; GOTO Decimal


onMinus:
Digit: add digit; GOTO Integer


onDecimal:
Other: Error


onInteger:
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.

Revision as of 21:04, 12 April 2008

Formatting Resources

Formatting Help Guide from MetaWiki

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.