CS110 Chapter Notes - Chapter 5: Finite-State Machine, Lexeme, Regular Expression
Document Summary
This document discusses details of finite state machine (fsm) and its applications: fsm is a virtual machine which can only be in exactly one state at a time. 3: main function, returns 1 if the c string represents a valid integer; otherwise 0, pseudocode: identical to case 1, application: If the current state is 1, return 2 if input is a negative sign, return 3 if input is a number, or return 4 if input is a colon; else return -1. If the current state is 2, return 3 if input is a number, or return 4 if input is a colon; else return -1. If the current state is 3, return 3 if input is a number or return 4 if input is a colon; else return -1. If the current state is 4, return 4 if input is a number; else return -1.