1/14
Vocabulary practice flashcards covering fundamental concepts, roles, structures, and input buffering techniques of lexical analysis in compiler design.
Lexical Analyzer (Lexer)
The first phase of a compiler that reads the input stream of characters from the source program, strips out whitespace and comments, groups characters into lexemes, and produces a sequence of tokens for syntax analysis by the parser.
Token
A sequence of characters from the source program having a collective meaning and representing a classification of lexical units; formally represented as a pair consisting of a token name and an optional attribute value.
Lexeme
A specific sequence of alphanumeric characters in the source program that matches the pattern for a token and is identified by the lexical analyzer as an instance of that token.
Pattern
A rule or description of the form that lexemes of a token may take, typically specified using regular expressions.
Symbol Table
A data structure with which the lexical analyzer interacts to store records of identifiers, containing information such as the lexeme, its type, and the line number where it was first seen.
Token Attribute
Additional information associated with a token that provides specific details about a lexeme (such as distinguishing the numbers 0 and 1 under token 'num'); practically implemented as a pointer to the token's entry in the symbol table.
Panic Mode Recovery
An error recovery method in which the lexical analyzer deletes or skips successive characters from the remaining input until it finds a well-formed token.
Transition Diagram
A stylized flowchart used in the construction of a lexical analyzer consisting of nodes called states and directed edges labeled with symbols, used to model token recognition.
Retract (∗)
An indicator on an accepting state in a transition diagram denoting that the lexical analyzer read one character beyond the token lexeme (such as an 'other' character) and must step back the input pointer by one character.
Begin Pointer (bp)
A pointer in an input buffering scheme that marks the starting position of the current lexeme being scanned.
Forward Pointer (fp)
A pointer in an input buffering scheme that moves ahead character by character to search for the delimiter indicating the end of the current lexeme.
One Buffer Scheme
An input buffering method using a single buffer, which fails when a long lexeme crosses the buffer boundary because refilling the buffer overwrites the beginning of the lexeme.
Two Buffer Scheme
An input buffering method that scans two buffers alternately, refilling one while the other is being scanned to avoid overwriting lexemes, limited only if a single lexeme exceeds the length of an entire buffer.
Sentinel
A special end-of-buffer marker (typically an eof character) placed at the end of each buffer in a two-buffer scheme to identify the boundary and trigger the loading or switching of buffers.
Macro Expansion
An additional task performed by some lexical analyzers where macro calls within the source code are expanded into their full definitions.