Chapter 3: Scanning Source Code

The first step in any programming language is reading the individual characters of input source code and figuring out which characters are grouped. In a natural language, this would include looking at the adjacent sequences of letters to identify the words. In a programming language, clusters of characters form variable names, reserved words, or sometimes operators or punctuation marks that are several characters long. This chapter will teach you how to use pattern matching to read in source code and identify the words and punctuation from the raw characters.

In this chapter, we're going to cover the following main topics:

  • Lexemes, lexical categories, and tokens
  • Regular expressions
  • Using UFlex and JFlex
  • Writing ...

Get Build Your Own Programming Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.