CS110 Chapter Notes - Chapter 5: Finite-State Machine, Regular Expression, Eval

57 views12 pages

Document Summary

This document is a complement to part 5 of chapter 6, which discusses in details about the proposed prototype of regular expression pattern recognizer. Note that the prototype only accepts or rejects string pattern, instead of looking for all possible matches in a huge string. In this document, the source code will be explained in a top-down approach (i. e. from huge macros to tiny details) The proposed regular expression recognizer is basically a collection of functions in proper sequence (and therefore is a product of functional programming approach). The main function named eval, which takes in two parameters i. e. string to be analyzed and regular expression string, and returns integer (1=true, 0=false), contains five auxiliary functions namely eatsymbol, eatsymbols, postsymbol, postsymbols, and eval functions. Note that in this approach, the state/input map is updated once a token is retrieved (as opposed to gaining all tokens prior to analysis).

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents