Lexical grammar
Encyclopedia
In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, a lexical grammar can be thought of as the syntax of tokens. That is, the rules governing how a character sequence is divided up into subsequences of characters, each part of which represents an individual token.

For instance, the lexical grammar for many programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

s specifies that a string starts with a " character and continues until a matching " is found, that an identifier is a sequence of letters and digits, and that a number is a sequence of digits. So in the following character sequence "abc" xyz1 23 the tokens are string, identifier and number (because the space character terminates the sequence of characters forming the identifier.)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK