-
Book Overview & Buying
-
Table Of Contents
Mastering Go - Third Edition
By :
Pattern matching is a technique for searching a string for some set of characters based on a specific search pattern that is based on regular expressions and grammars.
A regular expression is a sequence of characters that defines a search pattern. Every regular expression is compiled into a recognizer by building a generalized transition diagram called a finite automaton. A finite automaton can be either deterministic or nondeterministic. Nondeterministic means that more than one transition out of a state can be possible for the same input. A recognizer is a program that takes a string x as input and is able to tell whether x is a sentence of a given language.
A grammar is a set of production rules for strings in a formal language—the production rules describe how to create strings from the alphabet of the language that are valid according to the syntax of the language. A grammar does not describe the meaning of a string or...