Chapter 11. Control Flow

In this chapter, we are implementing the if and else keywords, and are approaching the more complex structures such as loops. After introducing the AST earlier, these tasks become quite doable. Also in this chapter: code blocks are introduced.

In this chapter, we are implementing the if and else keywords, and are approaching the more complex structures such as loops. After introducing the AST earlier, these tasks become quite doable. Also in this chapter: code blocks are introduced.

Chapter 10. Test suite

The compiler becomes bigger and bigger, and we are going to add more syntax to the Lingua language. It is a good time to make a pause in the compiler development and ensure some stability. In this chapter, we will create a test suite, which will allow us to find problems in the implementation and prevent new bugs when extending the language.

The compiler becomes bigger and bigger, and we are going to add more syntax to the Lingua language. It is a good time to make a pause in the compiler development and ensure some stability. In this chapter, we will create a test suite, which will allow us to find problems in the implementation and prevent new bugs when extending the language.

Chapter 9. Evaluating AST

In this chapter, we traverse the AST that was built earlier and create the methods to evaluate (or execute) the nodes according to their meaning. Another interesting feature of Raku, the so called getters, is used in the code.

In this chapter, we traverse the AST that was built earlier and create the methods to evaluate (or execute) the nodes according to their meaning. Another interesting feature of Raku, the so called getters, is used in the code.

Chapter 8. Building AST. Part 2

In the second part of this chapter, I am talking about building the AST fragments for hosting strings, arrays, and hashes, as well as bigger constructs such as expressions, and how to manipulate these elements in a program.

In the second part of this chapter, I am talking about building the AST fragments for hosting strings, arrays, and hashes, as well as bigger constructs such as expressions, and how to manipulate these elements in a program.

Chapter 8. Building AST. Part 1

In this chapter, we will be working on implementing AST, the abstract syntax tree, that represents the program in the form of connected nodes, which are responsible for atomic actions such as variable declaration, or computing a sum of two values, or calling a function. This is probably the most difficult and brain-puzzling chapters in the book.

In this chapter, we will be working on implementing AST, the abstract syntax tree, that represents the program in the form of connected nodes, which are responsible for atomic actions such as variable declaration, or computing a sum of two values, or calling a function. This is probably the most difficult and brain-puzzling chapters in the book.

Chapter 7. Arrays and Hashes

In this chapter, we will extend the Lingua language with aggregate data types: arrays and hashes. From this point, we will call variables that contain numbers and strings scalar variables.

In this chapter, we will extend the Lingua language with aggregate data types: arrays and hashes. From this point, we will call variables that contain numbers and strings scalar variables.

Chapter 6. Working with Strings

Until now, the language only worked with numbers—integer and floating point, both in regular and in scientific notation. In the following two chapters, we’ll update the language and integrate other data types to it: strings, arrays, and hashes. Let us start with strings.

Until now, the language only worked with numbers—integer and floating point, both in regular and in scientific notation. In the following two chapters, we’ll update the language and integrate other data types to it: strings, arrays, and hashes. Let us start with strings.

Chapter 5. Working on Grammar

In this chapter, we’ll review the grammar that was created so far and will try to make some changes to make the grammar and the actions more compact, more readable and more user-friendly. The bigger the language becomes, the more important it is to keep its code maintainable.

In this chapter, we’ll review the grammar that was created so far and will try to make some changes to make the grammar and the actions more compact, more readable and more user-friendly. The bigger the language becomes, the more important it is to keep its code maintainable.

Chapter 4. A Better Interpreter

The goal of this chapter is to build a better interpreter using all the achievements of the previous three chapters. The new interpreter will be able to work with numbers of different types and to perform different arithmetic operations with variables. To make it even better, we’ll start with a very useful addition — comments.

The goal of this chapter is to build a better interpreter using all the achievements of the previous three chapters. The new interpreter will be able to work with numbers of different types and to perform different arithmetic operations with variables. To make it even better, we’ll start with a very useful addition — comments.

Chapter 3. Creating a Calculator

In this chapter, we will create a program that can evaluate simple arithmetic expressions such as 3 + 4 or 3 – 3 * 7. We’ll start from the simplest equations with two operands and will work until we can introduce parentheses.

In this chapter, we will create a program that can evaluate simple arithmetic expressions such as 3 + 4 or 3 – 3 * 7. We’ll start from the simplest equations with two operands and will work until we can introduce parentheses.

Chapter 2. Parsing a Number

In the following two chapters, we will temporary leave the compiler created in the previous chapter, and will be working on a separate helper project, a calculator. It is an interesting thing on its own, and we will explore it on an isolated example. In the next chapters, it will be integrated to the interpreter.

In the following two chapters, we will temporary leave the compiler created in the previous chapter, and will be working on a separate helper project, a calculator. It is an interesting thing on its own, and we will explore it on an isolated example. In the next chapters, it will be integrated to the interpreter.

Chapter 1. Creating a Simple Interpreter

Let’s start exploring the power or Raku’s grammars and regexes from a simple interpreter program that parses and executes the following tiny program. I will call this language Lingua.

Let’s start exploring the power or Raku’s grammars and regexes from a simple interpreter program that parses and executes the following tiny program. I will call this language Lingua.