Chapter 2. Steps in Writing a Frontend

In this chapter, we will cover the following recipes:

  • Defining a TOY language
  • Implementing a lexer
  • Defining Abstract Syntax Tree
  • Implementing a parser
  • Parsing simple expressions
  • Parsing binary expressions
  • Invoking a driver for parsing
  • Running lexer and parser on our TOY language
  • Defining IR code generation methods for each AST class
  • Generating IR code for expressions
  • Generating IR code for functions
  • Adding IR optimization support

Introduction

In this chapter, you will get to know about how to write a frontend for a language. By making use of a custom-defined TOY language, you will have recipes on how to write a lexer and a parser, and how to generate IR code from the Abstract Syntax Tree (AST) generated by the frontend.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.181.36