Lexer: meaning, definitions and examples
💻
lexer
[ ˈlɛksər ]
computer programming
A lexer is a software tool used for breaking input into pieces called tokens. It is an essential component of a compiler or interpreter, responsible for analyzing the source code and converting it into a stream of tokens for further processing.
Synonyms
lexical analyzer, scanner, tokenizer.
Which Synonym Should You Choose?
Word | Description / Examples |
---|---|
lexer |
This term is primarily used in the context of programming and computer science. It's usually mentioned when discussing the early stages of compilation where source code is processed.
|
tokenizer |
This term is used widely not only in programming but also in natural language processing (NLP). It refers to the process of breaking a stream of text into tokens, which can be words, phrases, or other meaningful units.
|
scanner |
This word has a broader use case but is often applied in programming when referring to the process of reading and interpreting streams of characters. It's also used outside of programming in contexts like reading documents or barcodes.
|
lexical analyzer |
This is a more formal term than 'lexer' and might be used in academic or technical discussions. It refers specifically to the process of analyzing sequences of characters in programming languages.
|
Examples of usage
- The lexer scans the source code and identifies keywords, operators, and identifiers.
- After tokenizing the input, the lexer passes the tokens to the parser for syntax analysis.
Translations
Translations of the word "lexer" in other languages:
🇵🇹 analisador léxico
🇮🇳 लेक्सर
🇩🇪 Lexer
🇮🇩 lexer
🇺🇦 лексер
🇵🇱 lekser
🇯🇵 字句解析器 (じくかいせきき)
🇫🇷 analyseur lexical
🇪🇸 analizador léxico
🇹🇷 leksik analizör
🇰🇷 렉서
🇸🇦 محلل لغوي
🇨🇿 lexikální analyzátor
🇸🇰 lexikálny analyzátor
🇨🇳 词法分析器 (cí fǎ fēn xī qì)
🇸🇮 leksikalni analizator
🇮🇸 lexíkönnunarforrit
🇰🇿 лексикалық талдаушы
🇬🇪 ლექსიკური ანალიზატორი
🇦🇿 leksik analizator
🇲🇽 analizador léxico
Etymology
The term 'lexer' is a short form of 'lexical analyzer,' which dates back to the early days of compiler design in the 1950s. Lexers were introduced to separate the concerns of lexical analysis from other parsing tasks, leading to more modular and efficient compiler implementations.