Lexeme

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.

Advertisements

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.

Advertisements

Related Terms

Latest Computer Science Terms

Related Reading

Margaret Rouse

Margaret Rouse 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 explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…