Page xviii
15.4.1 StrBDel, StrBDelm ................................................................................................846
15.4.2 Strcat, Strcatl, Strcatm, Strcatml ............................................................................847
15.4.3 Strchr .....................................................................................................................848
15.4.4 Strcmp, Strcmpl, Stricmp, Stricmpl .......................................................................848
15.4.5 Strcpy, Strcpyl, Strdup, Strdupl .............................................................................849
15.4.6 Strdel, Strdelm .......................................................................................................850
15.4.7 Strins, Strinsl, Strinsm, Strinsml ............................................................................851
15.4.8 Strlen .....................................................................................................................852
15.4.9 Strlwr, Strlwrm, Strupr, Struprm ...........................................................................852
15.4.10 Strrev, Strrevm .....................................................................................................853
15.4.11 Strset, Strsetm ......................................................................................................853
15.4.12 Strspan, Strspanl, Strcspan, Strcspanl .................................................................854
15.4.13 Strstr, Strstrl .........................................................................................................855
15.4.14 Strtrim, Strtrimm ..................................................................................................855
15.4.15 Other String Routines in the UCR Standard Library ...........................................856
15.5 The Character Set Routines in the UCR Standard Library ...............................................856
15.6 Using the String Instructions on Other Data Types ........................................................859
15.6.1 Multi-precision Integer Strings .............................................................................859
15.6.2 Dealing with Whole Arrays and Records .............................................................860
15.7 Sample Programs .............................................................................................................860
15.7.1 Find.asm ................................................................................................................860
15.7.2 StrDemo.asm .........................................................................................................862
15.7.3 Fcmp.asm ..............................................................................................................865
15.8 Laboratory Exercises .......................................................................................................868
15.8.1 MOVS Performance Exercise #1 ...........................................................................868
15.8.2 MOVS Performance Exercise #2 ...........................................................................870
15.8.3 Memory Performance Exercise ............................................................................872
15.8.4 The Performance of Length-Prefixed vs. Zero-Terminated Strings .....................874
15.9 Programming Projects .....................................................................................................878
15.10 Summary ........................................................................................................................878
15.11 Questions .......................................................................................................................881
Chapter 16 Pattern Matching ....................................................................................... 883
16.1 An Introduction to Formal Language (Automata) Theory .............................................883
16.1.1 Machines vs. Languages .......................................................................................883
16.1.2 Regular Languages ................................................................................................884
16.1.2.1 Regular Expressions .................................................................................... 885
16.1.2.2 Nondeterministic Finite State Automata (NFAs) ........................................ 887
16.1.2.3 Converting Regular Expressions to NFAs ................................................... 888
16.1.2.4 Converting an NFA to Assembly Language ................................................ 890
16.1.2.5 Deterministic Finite State Automata (DFAs) .............................................. 893
16.1.2.6 Converting a DFA to Assembly Language .................................................. 895
16.1.3 Context Free Languages .......................................................................................900
16.1.4 Eliminating Left Recursion and Left Factoring CFGs ...........................................903
16.1.5 Converting REs to CFGs .......................................................................................905
16.1.6 Converting CFGs to Assembly Language .............................................................905
16.1.7 Some Final Comments on CFGs ...........................................................................912
16.1.8 Beyond Context Free Languages .........................................................................912
16.2 The UCR Standard Library Pattern Matching Routines ...................................................913
16.3 The Standard Library Pattern Matching Functions .........................................................914