English subtitles

← 02-21 Lexical Analyzer

Get Embed Code
3 Languages

Showing Revision 1 created 04/27/2012 by Amara Bot.

  1. You've now seen a bunch of these token definitions,
  2. one for words, one for strings.
  3. A lexical analyzer or lexer--this is a term of art--
  4. is just a collection of such tokens.
  5. You tell me what makes a word, what makes a string,
  6. what makes a number, what makes white space.
  7. You put it all together, and the result is a lexer,
  8. something that splits a string into exactly
  9. the token definitions you've given it.
  10. For example, once I put these 3 rules together,
  11. they become a lexer, or lexical analyzer.
  12. And in fact, suppose we passed to this lexical analyzer
  13. the input string 33 is less than 55.
  14. Oh, gentle student, tell to me which one of these
  15. token output sequences could result.
  16. In this multiple choice quiz,
  17. indicate which of these 3 possible output lists
  18. could correspond to the values of the tokens
  19. extracted from this input string using these rules.
  20. Let's put it all together.