Professional Documents
Culture Documents
5 Input Buffering+Relop
5 Input Buffering+Relop
Compiler Design
KCS502
by
DR PARUL YADAV
• We must check, each time we advance forward, that we have not moved off
one of the buffers.
• If we do, then reload the other buffer.
• Make 2 tests for each for each character read:
1. one for the end of the buffer
2.One to determine what character is read
• Both tests can be combined, extending each buffer to hold a sentinel character
at the end
Sentinels at the End of Each Buffer
Lookahead code with sentinels
Token Specification: Regular Expression
Regular Expression
Regular Expression: Operator
Precedence
Regular Expression: Example
Regular Expression: Algebraic Laws
Regular Definitions
Regular Definitions
Regular Expression: Extension
Regular Expression: Extension
Regular Expression: Extension
Rewriting Regular Definitions
Rewriting Regular Definitions
Recognition of Tokens: Grammar
Recognition of Tokens: Patterns for
Tokens
No token
Tokens, Patterns and Attribute Values
Transition diagram for
Transition Diagram for ’s and
Keywords
Transition Diagram for Keywords
Transition Diagram for Unsigned
Numbers
Transition Diagram for Whitespace
Implementation of
Thank you