#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::Crafting Interpreters::Ch 16 Scanning on Demand
#columns:Front	Back	Tags
Crafting Interpreters ch 16, Scanning on Demand: what does it cover?	A new scanner for clox that produces tokens on demand instead of all at once, pointing into the source string rather than copying lexemes, with a hand-written trie-like switch for keywords.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::about
Crafting Interpreters ch 16, Scanning on Demand: why does it matter?	Zero-copy scanning is how fast real-world parsers work. The keyword switch is a neat trick worth stealing.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::why
Crafting Interpreters ch 16, Scanning on Demand: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::part
Crafting Interpreters ch 16, a common trap: “Token lexemes are not null-terminated.” What's the catch?	Never pass them to printf with %s; use %.*s.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::trap
Crafting Interpreters ch 16: what traps should you watch for?	<ul><li>The source buffer must outlive all tokens.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::traps
Crafting Interpreters ch 16: which end-of-chapter challenges are worth your time?	Challenge 1 (string interpolation) is a great design problem; think through how the scanner would need to cooperate with the parser. Challenges 2 and 3 are design discussions.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::challenges
Crafting Interpreters ch 16, Scanning on Demand: how should you work through it?	Compare each function with your jlox scanner. Note how lexemes are pointers plus lengths, not strings.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::16 cracked.guide::kind::approach
