SlideShare a Scribd company logo
1 of 125
INPUT BUFFERING
• Speed of lexical analysis is a concern.
• Lexical analysis needs to look ahead several
characters before a match can be announced.
• We have two buffer input scheme that is
useful when look ahead is necessary
– Buffer Pairs
– Sentinels
Buffer Pairs
• Buffer is divided into two N-characters halves.
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
N
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
N N
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
N N
Figure: An input buffer in two halves.
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
N N
Figure: An input buffer in two halves.
1st half
Buffer Pairs
• Buffer is divided into two N-characters halves.
• N is number of characters eg: 1024 or 4096.
N N
Figure: An input buffer in two halves.
1st half 2nd half
Lexeme_begining
Lexeme_begining
forward
Lexeme_begining
forward
Lexeme_begining
forward
Lexeme_begining
forward
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
if forward at end of first half then begin
reload second half;
forward := forward +1
end
else if forward at end of second half then begin
reload first half;
move forward to beginning of first half
end
else forward := forward + 1;
For Eg: consider
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
abc
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
abc  Identifier
: a : b : c : = : p :
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
=
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
=  operator
: a : b : c : = : p :
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
For Eg: consider
abc = pqr * xyz;
Reload 2nd half
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
Reload 2nd half
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
pqr
: a : b : c : = : p : q : r : * : x : y : z : eof :
Lexeme_begining
forward
For Eg: consider
abc = pqr * xyz;
pqr  identifier
Sentinels
Sentinels
Sentinels
Lexeme_begining
Sentinels
Lexeme_begining
forward
Sentinels
Lexeme_begining
forward
|eof
Sentinels
Lexeme_begining
forward
|eof |eof
• For Example: Consider
E = M * C * * 2
: : : E : : = : M : * : eof : eof
• For Example: Consider
E = M * C * * 2
: : : E : : = : M : * : eof : eof
• For Example: Consider
E = M * C * * 2
: : : E : : = : M : * : eof : eof
Lexeme_begining
• For Example: Consider
E = M * C * * 2
: : : E : : = : M : * : eof : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
Lexeme_begining
: : : E : : = : M : * : eof : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
Lexeme_begining
: : : E : : = : M : * : eof : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
Lexeme_begining
: : : E : : = : M : * : eof : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
: : : E : : = : M : * : eof : eof
Lexeme_begining
: : : E : : = : M : * : eof : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof eof
: : : E : : = : M : * : eof eof
: : : E : : = : M : * : eof eof
Lexeme_begining
: : : E : : = : M : * : eof eof
Lexeme_begining
forward
: : : E : : = : M : * : eof eof
: : : E : : = : M : * : eof eof
: : : E : : = : M : * : eof eof
Lexeme_begining
: : : E : : = : M : * : eof eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
: : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
Lexeme_begining
forward
forward : = forward + 1;
if forward = eof then begin
if forward at end of first half then begin
reload second half;
forward := forward + 1
end
else if forward at end of second half then begin
reload first half
move forward to beginning of first half
end
else /* eof within a buffer signifying end of input */
terminate lexical analysis
end
forward : = forward + 1;
if forward = eof then begin
if forward at end of first half then begin
reload second half;
forward := forward + 1
end
else if forward at end of second half then begin
reload first half
move forward to beginning of first half
end
else /* eof within a buffer signifying end of input */
terminate lexical analysis
end

More Related Content

What's hot

What's hot (20)

Bottom up parser
Bottom up parserBottom up parser
Bottom up parser
 
Token, Pattern and Lexeme
Token, Pattern and LexemeToken, Pattern and Lexeme
Token, Pattern and Lexeme
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
 
Lexical analyzer generator lex
Lexical analyzer generator lexLexical analyzer generator lex
Lexical analyzer generator lex
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Extensible hashing
Extensible hashingExtensible hashing
Extensible hashing
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
LL(1) parsing
LL(1) parsingLL(1) parsing
LL(1) parsing
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Top down and botttom up Parsing
Top down     and botttom up ParsingTop down     and botttom up Parsing
Top down and botttom up Parsing
 
The role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler designThe role of the parser and Error recovery strategies ppt in compiler design
The role of the parser and Error recovery strategies ppt in compiler design
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Intermediate code generator
Intermediate code generatorIntermediate code generator
Intermediate code generator
 
Semantic analysis
Semantic analysisSemantic analysis
Semantic analysis
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
Register allocation and assignment
Register allocation and assignmentRegister allocation and assignment
Register allocation and assignment
 

Recently uploaded

BOW 2024 -3-9 - Matelas de logettes à eau refroidie VL
BOW 2024 -3-9 - Matelas de logettes à eau refroidie VLBOW 2024 -3-9 - Matelas de logettes à eau refroidie VL
BOW 2024 -3-9 - Matelas de logettes à eau refroidie VLidelewebmestre
 
Accompagnement de l'agrivoltaïsme dans le département de la Nièvre
Accompagnement de l'agrivoltaïsme dans le département de la NièvreAccompagnement de l'agrivoltaïsme dans le département de la Nièvre
Accompagnement de l'agrivoltaïsme dans le département de la Nièvreidelewebmestre
 
BOW 2024-3-10 - Batcool Petits ruminants
BOW 2024-3-10 - Batcool Petits ruminantsBOW 2024-3-10 - Batcool Petits ruminants
BOW 2024-3-10 - Batcool Petits ruminantsidelewebmestre
 
BOW 2024 - Le bâtiment multicritère porcin
BOW 2024 - Le bâtiment multicritère porcinBOW 2024 - Le bâtiment multicritère porcin
BOW 2024 - Le bâtiment multicritère porcinidelewebmestre
 
BOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcins
BOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcinsBOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcins
BOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcinsidelewebmestre
 
Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...
Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...
Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...idelewebmestre
 
Agrivoltaïsme et filière ovine en Dordogne
Agrivoltaïsme et filière ovine en DordogneAgrivoltaïsme et filière ovine en Dordogne
Agrivoltaïsme et filière ovine en Dordogneidelewebmestre
 
BOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleur
BOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleurBOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleur
BOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleuridelewebmestre
 
BOW 2024 - L'enrichissement du milieu des chèvres laitières
BOW 2024 - L'enrichissement du milieu des chèvres laitièresBOW 2024 - L'enrichissement du milieu des chèvres laitières
BOW 2024 - L'enrichissement du milieu des chèvres laitièresidelewebmestre
 
BOW 2024 - 3-3 - Adaptation des bâtiments pour ruminants au changement clima...
BOW 2024 - 3-3 -  Adaptation des bâtiments pour ruminants au changement clima...BOW 2024 - 3-3 -  Adaptation des bâtiments pour ruminants au changement clima...
BOW 2024 - 3-3 - Adaptation des bâtiments pour ruminants au changement clima...idelewebmestre
 
Bow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminants
Bow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminantsBow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminants
Bow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminantsidelewebmestre
 
BOW 2024 - 3-2 - Stress thermique impact vaches laitières
BOW 2024 - 3-2 - Stress thermique impact vaches laitièresBOW 2024 - 3-2 - Stress thermique impact vaches laitières
BOW 2024 - 3-2 - Stress thermique impact vaches laitièresidelewebmestre
 
BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...
BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...
BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...idelewebmestre
 
BOW 2024 - Dedans/Dehors quand voir ne suffit pas
BOW 2024 - Dedans/Dehors quand voir ne suffit pasBOW 2024 - Dedans/Dehors quand voir ne suffit pas
BOW 2024 - Dedans/Dehors quand voir ne suffit pasidelewebmestre
 
BOW 2024 - 3-6 - Adaptation climat chaud Porcs
BOW 2024 - 3-6 - Adaptation climat chaud PorcsBOW 2024 - 3-6 - Adaptation climat chaud Porcs
BOW 2024 - 3-6 - Adaptation climat chaud Porcsidelewebmestre
 
BOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équine
BOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équineBOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équine
BOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équineidelewebmestre
 
BOW 2024 - 3 1 - Les infrastructures équestres et le changement climatique
BOW 2024 - 3 1 - Les infrastructures équestres et le changement climatiqueBOW 2024 - 3 1 - Les infrastructures équestres et le changement climatique
BOW 2024 - 3 1 - Les infrastructures équestres et le changement climatiqueidelewebmestre
 
BOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitières
BOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitièresBOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitières
BOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitièresidelewebmestre
 

Recently uploaded (20)

BOW 2024 -3-9 - Matelas de logettes à eau refroidie VL
BOW 2024 -3-9 - Matelas de logettes à eau refroidie VLBOW 2024 -3-9 - Matelas de logettes à eau refroidie VL
BOW 2024 -3-9 - Matelas de logettes à eau refroidie VL
 
Accompagnement de l'agrivoltaïsme dans le département de la Nièvre
Accompagnement de l'agrivoltaïsme dans le département de la NièvreAccompagnement de l'agrivoltaïsme dans le département de la Nièvre
Accompagnement de l'agrivoltaïsme dans le département de la Nièvre
 
BOW 2024-3-10 - Batcool Petits ruminants
BOW 2024-3-10 - Batcool Petits ruminantsBOW 2024-3-10 - Batcool Petits ruminants
BOW 2024-3-10 - Batcool Petits ruminants
 
BOW 2024 - Le bâtiment multicritère porcin
BOW 2024 - Le bâtiment multicritère porcinBOW 2024 - Le bâtiment multicritère porcin
BOW 2024 - Le bâtiment multicritère porcin
 
BOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcins
BOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcinsBOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcins
BOW 24 - De la réflexion de groupe à l'immersion dans des bâtiments porcins
 
Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...
Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...
Accompagnement de l'agrivoltaisme - Focus sur l'étude système en Merthe et Mo...
 
Agrivoltaïsme et filière ovine en Dordogne
Agrivoltaïsme et filière ovine en DordogneAgrivoltaïsme et filière ovine en Dordogne
Agrivoltaïsme et filière ovine en Dordogne
 
BOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleur
BOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleurBOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleur
BOW 2024 - 3-5 - Des solutions numériques pour se préparer aux pics de chaleur
 
BOW 2024 - L'enrichissement du milieu des chèvres laitières
BOW 2024 - L'enrichissement du milieu des chèvres laitièresBOW 2024 - L'enrichissement du milieu des chèvres laitières
BOW 2024 - L'enrichissement du milieu des chèvres laitières
 
BOW 2024 - 3-3 - Adaptation des bâtiments pour ruminants au changement clima...
BOW 2024 - 3-3 -  Adaptation des bâtiments pour ruminants au changement clima...BOW 2024 - 3-3 -  Adaptation des bâtiments pour ruminants au changement clima...
BOW 2024 - 3-3 - Adaptation des bâtiments pour ruminants au changement clima...
 
Bow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminants
Bow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminantsBow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminants
Bow 2024 - Plein air à l'intérieur des bâtiments d'élevage de ruminants
 
BOW 2024 - 3-2 - Stress thermique impact vaches laitières
BOW 2024 - 3-2 - Stress thermique impact vaches laitièresBOW 2024 - 3-2 - Stress thermique impact vaches laitières
BOW 2024 - 3-2 - Stress thermique impact vaches laitières
 
BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...
BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...
BOW 2024 - 3-8 - Adaptation des bâtiments d'élevages de volailles au changeme...
 
BOW 2024 - Dedans/Dehors quand voir ne suffit pas
BOW 2024 - Dedans/Dehors quand voir ne suffit pasBOW 2024 - Dedans/Dehors quand voir ne suffit pas
BOW 2024 - Dedans/Dehors quand voir ne suffit pas
 
BOW 2024 - 3-6 - Adaptation climat chaud Porcs
BOW 2024 - 3-6 - Adaptation climat chaud PorcsBOW 2024 - 3-6 - Adaptation climat chaud Porcs
BOW 2024 - 3-6 - Adaptation climat chaud Porcs
 
Webinaire lésions podales_04.04.2024.pptx
Webinaire lésions podales_04.04.2024.pptxWebinaire lésions podales_04.04.2024.pptx
Webinaire lésions podales_04.04.2024.pptx
 
BOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équine
BOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équineBOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équine
BOW 2024 - L'écurie ouverte : un concept inspirant pour la filière équine
 
BOW 2024 - 3 1 - Les infrastructures équestres et le changement climatique
BOW 2024 - 3 1 - Les infrastructures équestres et le changement climatiqueBOW 2024 - 3 1 - Les infrastructures équestres et le changement climatique
BOW 2024 - 3 1 - Les infrastructures équestres et le changement climatique
 
BOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitières
BOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitièresBOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitières
BOW 2024 -3-7- Impact bâtiment stress thermique Vaches laitières
 
Note agro-climatique n°2 - 17 Avril 2024
Note agro-climatique n°2 - 17 Avril 2024Note agro-climatique n°2 - 17 Avril 2024
Note agro-climatique n°2 - 17 Avril 2024
 

Input-Buffering

  • 1. INPUT BUFFERING • Speed of lexical analysis is a concern. • Lexical analysis needs to look ahead several characters before a match can be announced. • We have two buffer input scheme that is useful when look ahead is necessary – Buffer Pairs – Sentinels
  • 2. Buffer Pairs • Buffer is divided into two N-characters halves.
  • 3. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096.
  • 4. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096.
  • 5. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096.
  • 6. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096.
  • 7. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096. N
  • 8. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096. N N
  • 9. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096. N N Figure: An input buffer in two halves.
  • 10. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096. N N Figure: An input buffer in two halves. 1st half
  • 11. Buffer Pairs • Buffer is divided into two N-characters halves. • N is number of characters eg: 1024 or 4096. N N Figure: An input buffer in two halves. 1st half 2nd half
  • 12.
  • 13.
  • 19. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 20. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 21. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 22. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 23. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 24. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 25. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 26. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 27. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 28. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 29. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 30. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 31. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 32. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 33. if forward at end of first half then begin reload second half; forward := forward +1 end else if forward at end of second half then begin reload first half; move forward to beginning of first half end else forward := forward + 1;
  • 35. For Eg: consider abc = pqr * xyz;
  • 36. : a : b : c : = : p : For Eg: consider abc = pqr * xyz;
  • 37. : a : b : c : = : p : For Eg: consider abc = pqr * xyz;
  • 38. : a : b : c : = : p : Lexeme_begining For Eg: consider abc = pqr * xyz;
  • 39. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 40. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 41. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 42. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 43. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz; abc
  • 44. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz; abc  Identifier
  • 45. : a : b : c : = : p : For Eg: consider abc = pqr * xyz;
  • 46. : a : b : c : = : p : Lexeme_begining For Eg: consider abc = pqr * xyz;
  • 47. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 48. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 49. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz; =
  • 50. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz; =  operator
  • 51. : a : b : c : = : p : For Eg: consider abc = pqr * xyz;
  • 52. : a : b : c : = : p : Lexeme_begining For Eg: consider abc = pqr * xyz;
  • 53. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 54. : a : b : c : = : p : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 55. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining For Eg: consider abc = pqr * xyz;
  • 56. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining For Eg: consider abc = pqr * xyz; Reload 2nd half
  • 57. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining forward For Eg: consider abc = pqr * xyz; Reload 2nd half
  • 58. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 59. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining forward For Eg: consider abc = pqr * xyz;
  • 60. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining forward For Eg: consider abc = pqr * xyz; pqr
  • 61. : a : b : c : = : p : q : r : * : x : y : z : eof : Lexeme_begining forward For Eg: consider abc = pqr * xyz; pqr  identifier
  • 68. • For Example: Consider E = M * C * * 2 : : : E : : = : M : * : eof : eof
  • 69. • For Example: Consider E = M * C * * 2 : : : E : : = : M : * : eof : eof
  • 70. • For Example: Consider E = M * C * * 2 : : : E : : = : M : * : eof : eof Lexeme_begining
  • 71. • For Example: Consider E = M * C * * 2 : : : E : : = : M : * : eof : eof Lexeme_begining forward
  • 72. : : : E : : = : M : * : eof : eof
  • 73. : : : E : : = : M : * : eof : eof
  • 74. : : : E : : = : M : * : eof : eof Lexeme_begining
  • 75. : : : E : : = : M : * : eof : eof Lexeme_begining forward
  • 76. : : : E : : = : M : * : eof : eof
  • 77. : : : E : : = : M : * : eof : eof
  • 78. : : : E : : = : M : * : eof : eof Lexeme_begining
  • 79. : : : E : : = : M : * : eof : eof Lexeme_begining forward
  • 80. : : : E : : = : M : * : eof : eof
  • 81. : : : E : : = : M : * : eof : eof
  • 82. : : : E : : = : M : * : eof : eof Lexeme_begining
  • 83. : : : E : : = : M : * : eof : eof Lexeme_begining forward
  • 84. : : : E : : = : M : * : eof : eof
  • 85. : : : E : : = : M : * : eof : eof
  • 86. : : : E : : = : M : * : eof : eof Lexeme_begining
  • 87. : : : E : : = : M : * : eof : eof Lexeme_begining forward
  • 88. : : : E : : = : M : * : eof eof
  • 89. : : : E : : = : M : * : eof eof
  • 90. : : : E : : = : M : * : eof eof Lexeme_begining
  • 91. : : : E : : = : M : * : eof eof Lexeme_begining forward
  • 92. : : : E : : = : M : * : eof eof
  • 93. : : : E : : = : M : * : eof eof
  • 94. : : : E : : = : M : * : eof eof Lexeme_begining
  • 95. : : : E : : = : M : * : eof eof Lexeme_begining forward
  • 96. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 97. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 98. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 99. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 100. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 101. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 102. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 103. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 104. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 105. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 106. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 107. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 108. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 109. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 110. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 111. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 112. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 113. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 114. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 115. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 116. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 117. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 118. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 119. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 120. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 121. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof
  • 122. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining
  • 123. : : : E : : = : M : * : eof C : * : * : 2 : eof: : : : : eof Lexeme_begining forward
  • 124. forward : = forward + 1; if forward = eof then begin if forward at end of first half then begin reload second half; forward := forward + 1 end else if forward at end of second half then begin reload first half move forward to beginning of first half end else /* eof within a buffer signifying end of input */ terminate lexical analysis end
  • 125. forward : = forward + 1; if forward = eof then begin if forward at end of first half then begin reload second half; forward := forward + 1 end else if forward at end of second half then begin reload first half move forward to beginning of first half end else /* eof within a buffer signifying end of input */ terminate lexical analysis end