What Does Lexeme Mean?

A lexeme is a sequence of alphanumeric characters in a token. The term is used in both the study of language and in the lexical analysis of computer program compilation. In the context of computer programming, lexemes are part of the input stream from which tokens are identified. An invalid or illegal token produces an error. A lexeme is one of the building blocks of language.


Techopedia Explains Lexeme

A lexeme is a basic unit of meaning. Lexemes are the headwords in dictionaries. The lexeme “play,” for example, can take many forms, such as playing, plays, played. A lexicon consists of lexemes.

Lexemes also play an important part in computer programming languages. However, the precision required in computer languages can be much more stringent. One stray character or misplaced symbol can stop an entire operation. During program compilation, lexical analysis is the computer’s attempt to make sense of the strings of characters in the input stream.

Each lexeme is analyzed for its usefulness. Particular patterns of alphanumeric strings make up what the computer recognizes as tokens. These tokens may be identifiers, keywords, operators, special symbols or constants. Valid tokens are used to form expressions that are part of the instructions of a computer program. The lexeme “Div” might be recognized as an identifier token. The computer may see “*” as a multiplier and “2” as a number.

Proper syntax is essential to good programming. Whereas in human speech one may be able to get by with slang, poor grammar or mispronunciation, computer language is generally more demanding.


Related Terms

Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.