Partial preview of the text
Download Input Buffering - Compiler Design and more Study notes Compiler Design in PDF only on Docsity!
Tnpur Buffaing. Tre hexteat analyces cans the chotactes of tte source program one ot a tre to discoves tokens. Howeves, many charactew beyond tne ext token may have +o be exanired before the ‘vext token jtselP can be cletewwiined. _sofor this and othe, veasons, it is desivable for the Uuxical anaytees to -yeacls Its _imput from an_input buffes “There ave many aches thot can be ured to buffer input. > Below Figquie shows a buffer scheme tmolves two buffers -thot ae alesnotely reloaded . Ny =<— N = 7 T Ty lea rel el ee ee Severe Forward begin _> Cach_ bubfes is of tHe and N is usually He gree oh a disk bleclS, €9- yore bytes. Wing one system read and we can vead Ni Chatactes lydo 9 boufher , ‘vatet nan using ore sytem call pet charactes . ahan No Chasactevs yemain In He input tide, stern a Special character, represented] by ech, mak s tHe end ot tHe source File. sayye site N, > F Feou — Two pointers +o +he input cue maintained. A. Poiwrtes Lexerns Begin, mmaiks the beginning of He curvvent Jexeme- 2. Pointer Fox waid oY until a paiteun match Lookainead pointes com ahead is found;