0 оценок0% нашли этот документ полезным (0 голосов)
37 просмотров7 страниц
The document discusses the role and implementation of a lexical analyzer. It can be summarized as follows:
1. A lexical analyzer groups input characters into tokens by recognizing patterns defined by regular expressions. It strips whitespace and returns tokens to the syntax analyzer.
2. Lexical analyzers can be implemented using scanner generator tools like flex, or by hand coding in a high-level or assembly language. Flex uses regular expression rules and actions to generate a lexical analyzer from a specification file.
3. A lexical analyzer returns tokens for identifiers, keywords, punctuation, operators, string literals, numeric literals and comments while tracking line numbers and errors. It interfaces with the parser to return the next meaningful token.
The document discusses the role and implementation of a lexical analyzer. It can be summarized as follows:
1. A lexical analyzer groups input characters into tokens by recognizing patterns defined by regular expressions. It strips whitespace and returns tokens to the syntax analyzer.
2. Lexical analyzers can be implemented using scanner generator tools like flex, or by hand coding in a high-level or assembly language. Flex uses regular expression rules and actions to generate a lexical analyzer from a specification file.
3. A lexical analyzer returns tokens for identifiers, keywords, punctuation, operators, string literals, numeric literals and comments while tracking line numbers and errors. It interfaces with the parser to return the next meaningful token.
Авторское право:
Attribution Non-Commercial (BY-NC)
Доступные форматы
Скачайте в формате PDF, TXT или читайте онлайн в Scribd
The document discusses the role and implementation of a lexical analyzer. It can be summarized as follows:
1. A lexical analyzer groups input characters into tokens by recognizing patterns defined by regular expressions. It strips whitespace and returns tokens to the syntax analyzer.
2. Lexical analyzers can be implemented using scanner generator tools like flex, or by hand coding in a high-level or assembly language. Flex uses regular expression rules and actions to generate a lexical analyzer from a specification file.
3. A lexical analyzer returns tokens for identifiers, keywords, punctuation, operators, string literals, numeric literals and comments while tracking line numbers and errors. It interfaces with the parser to return the next meaningful token.
Авторское право:
Attribution Non-Commercial (BY-NC)
Доступные форматы
Скачайте в формате PDF, TXT или читайте онлайн в Scribd