Maximal munch

For instance, the lexical syntax of many programming languages requires that tokens be built from the maximum possible number of characters from the input stream.

[2] The term is also used in compilers in the instruction selection stage to describe a method of "tiling" — determining how a structured tree representing a program in an intermediate language should be converted into linear machine code.

What was actually meant in the statement was to assign to the variable x the result of dividing the value in y by the value obtained by dereferencing pointer z; this would be valid code.

Programming languages researchers have also responded by replacing or supplementing the principle of maximal munch with other lexical disambiguation tactics.

For example, stipulating that strings matching [a-z]+ cannot be followed by an alphabetic character achieves the same effect as maximal munch with that regular expression.