Lecture 20

11/23/98


Click here to start


Table of Contents

Lecture 20

State machines

The phone conversion program

Defining the input format

Observe the details to extract states.

State machine

State transition diagram

Parsers (essentially a ‘format-enforcer’)

Phone number parser

Phone number parser

Phone number parser

How do we code the state machine?

Why use state machines?

Phone number example state machine

Optional (hard) problem for next time

While loops

Format

While loop

While loop is actually more powerful than for-loop

While loop is actually more powerful than for-loop

Simulating the for-loop with while loop

Home work

Program from this lecture

Author: Alex Iskold

Email: iskold@cs.nyu.edu

Download presentation source