Chapter 4: Parsing

In this chapter, you will learn how to take individual words and punctuation, the lexemes, and group them into larger programming constructs, such as expressions, statements, functions, classes, and packages. This task is called parsing. The code module is called a parser. You will make a parser by specifying syntax rules using grammars, and then using a parser generator tool that takes your language grammar and generates a parser for you. We will also look at writing useful syntax error messages.

This chapter covers the following main topics:

  • Syntax analysis
  • Context-free grammars
  • Using iyacc and BYACC/J
  • Writing a parser for Jzero
  • Improving syntax error messages

We will review the technical requirements for this chapter, ...

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.