Upon detecting a particular sequence, Lex can return a value usable by Yacc, which can do more with the string. Syntactical analysis is the process of determining if an input stream, once broken into its component parts by lexical anlysis, fits a particular structure. Yacc uses grammars as a means of determining structure. In addition to general grammars, Yacc provides allows specificiation of precedence and associativity.
Tokens are discrete literals or classes of characters which comprise an input stream.
In ambiguous grammars, there are often multiple paths that lead to a specific deriviation, and there are also a many paths which lead to dead ends. Thus, choosing from the alternate paths available at any given point in the derivation could lead to conflicts, such as determining whether or not to shift when it is possible to reduce, or determining which way to reduce if more than one way presents itself. Yacc always follows a set of guidelines when presented with conflicts. If given a choice between shifting or reducing, Yacc chooses to shift. Or, if there are two ways to reduce, choose the means of reduction specified by the earlier grammar rule.