
Introduction to developing an interpreter using Go programming
Birds eye view on what interpreter does
Installing Go and Visual Studio Code
Introduction to Monkey Programming Language
Process in Lexer Phase
We will understand the program that will be used for understanding Lexical Analysis
We will do Lexical Analysis on our own
Token type struct to hold token types
Create all different token type constants
We will create unit testing in Go to test by following TDD
New function that creates a reference to Lexer
A help function to read characters one by one
A function that reads character by character and returns a token
Updating the existing test to accommodate syntactic changes
Updating NextToken method to infer new test code
Looking up Identifiers until whitespace
Ignore whitespaces when reading tokens
Add the ability to read integers
Add more single character tokens
Updating Lexer to tokenize newly added single character tokens
Updating test input with conditional expression
Updating token list with new keywords
Interpreting multiple special characters
Creating REPL
Introduction to Parsing Phase
Information about Parser Generators
Different Parser types and we choose Recursion Descent Parsing type
Intro to Let Statements in Monkey Programming Language
AST package and its interfaces
Struct to handle let statments
First parser package functions
Understanding Recursive Descent Parsing logic using Pseudo Code
Writing test for parsing let statements
Parsing let statements implementation
We will add errors field to Parser struct and add some helper functions to work with error field
We will update the expect peek method to call peek errors so errors are added to the slice
We will create Return Statement struct in AST Package
We will add tests for parsing return statement
We will add login to parse return statements inside parser package
We will learn about the challenges we face when parsing expressions
Expressions in Monkey Programming Language
We will add new struct for Expression Statement
Adding implementation of String method for all struct types that implement Node interface
Adding test case for String method in ast package
Starting the implementation of Pratt Parser
Adding helper functions to register expression functions
Adding test for Parsing Identifiers
We will add different precedence constants using iota
Finishing the implementation to parse the identifier
We will write test case for parsing integer literals
We will finish the implementation for parsing integers
Writing test case for parsing prefix operator
We will create a new type in AST package for parsing Prefix Expression
Finishing the implementation logic for prefix expression parsing
Writing test case for parsing infix expression
We will add the new type in AST package that houses fields for parsing infix expression type
Implementation of Infix Expression logic with all methods and helper functions
Add additional test case for testing operator precedence
We will go over pratt parse logic once again
Pratt parser explanation through function call stack
Refactoring test cases to use helper methods
AST type implementation for boolean
Boolean parser logic implementation
Adding additional test case and implementation for parsing grouped expressions
AST structures for If expression
Adding two test cases for testing if and if-else expressions
Implementation logic for parsing if expression
Implementation of else block in if expression parser logic
AST structure for function literal
Test case for parsing function literal
Function Literal implementation
AST structure for call expression
Adding test cases for parsing call expression
Implementation of parser logic for call expression
Fixing precedence of call expression so it gets higher precedence
Test case for testing parsing arguments of call expression
We will finish the TODO list - parsing expression in let and return statements
Updating REPL to make use of parser package and ending with happy note by adding a monkey face ASCII
Introduction to Evaluation Stage
Different strategies present for evaluation a source code
We discuss the pseudocode of a tree walking interpreter
Many questions related to representing objects are raised
We will create new object package and types inside the package
We will create our first data type - Integer
Adding Boolean and Null Object types
Test case for evaluating integer expression
Implementing initial Eval function to evaluate integer expression
Completing the loop of REPL
Implementation of Eval functions boolean object case
Implementation of Null object the easiest implementation
Implementation of Evaluation logic for bang prefix operator
Implementation of Evaluation logic for minus prefix operator
Evaluation of Integer Object with +, - , * and / operators
Adding support for Integer infix with operators <, >, etc
Evaluation of boolean infix expression
Evaluating conditionals
Evaluating Return Type
Fixing the issue with return type when present inside nested conditionals
New Error Object in object package
Handling error scenarios inside evaluator package
handling error scenarios in If expressions, etc that is called inside Eval method
Adding test cases for evaluating let statements
Adding Environment object that houses connection between variable and its value
Completing the let statement evaluation
Evaluating a simple function
Adding a new case for call expressions in Eval method
Implementation of parsing the arguments passed to the function
Continuing with the Function Evaluation
Finishing the evaluation of all types of functions
Explaining the reasoning behind unwrapping function from the previous lecture
Getting in touch with the concept of Closures
section conclusion
Section Introduction
Adding test case for lexer phase of string data type
Finishing the Lexer implementation for String data type
Implementing Parser phase for String data type
Evaluation Phase for String data type
Implementing the functionality for String concatenation
Creating an object type for builtin functions
Test case for builtin len function
Implementation of len builtin
Introduction to Array Object
Lexer Phase for Array
Parser phase for Array
Parsing of Index Expressions
Evaluation of Array Literal
Modifying len builtin function to get length of arrays as well
Adding first and last builtin functions
Adding rest and push builtin functions
Lexer stage for Hash data structure
Parsing of hash data structure
Parsing of hash data structure
Adding a Hash Key and Interface
Object type for Hash finally
Evaluating logic for Hash
Completing the logic for evaluating Hash
Creating new builtin function puts that prints output to the screen
Closing comments
Hello everyone welcome to the course Develop an Interpreter using Go Programming.
This course is a comprehensive and practical guide that takes you on a journey of building your own interpreter using the Go programming language. This course is inspired by the great book Writing An Interpreter In Go by Thorsten Ball. All credit to him as well. We will demystify the complex world of interpreters in this course.
The course begins by introducing the fundamental concepts of interpreters and programming languages, making it accessible to both beginners and experienced developers. We will build an interpreter using Go for a custom programming language called Monkey through a hands-on approach.
we will understand key concepts such as lexical analysis, parsing, and evaluating expressions. In the course we will learn how to design and implement a lexer and a recursive descent parser, providing you learners with a solid foundation in language processing techniques.
The course will help developers seeking to deepen their understanding of language implementation. We will use Go as it is simple and easy to use.
During the process of developing an interpreter, we will also learn more advanced topics like closures, first-class functions, and error handling.
By the end of the course, you would have hopefully gained a deep understanding of how interpreters work and the skills to build your own programming language, opening up new possibilities for exploration and creativity in the world of software development.