In this drive by code session WaiKit and I start a series on the topic of making programming languages. I will give an overview on what it means to make a programming language and explain what is it that you’d be making if you want to make a programming language.
I give an explanation of parsers and AST to prep you for the next episode of where we show you how to build a parser for a programming language.
In this drive by code session I replay WaiKit’s code session where he builds a parser for a programming language called MyPL. This is part 3 in a series about building programming languages. I recommend watching the first 2 in the series before this one.
In this drive by code session we finish build the parser for MyPL - the programming language we are making.
In this drive by code session we finish building a programming language called MyPL by writing a generator that takes MyPL AST format and translates it to JavaScript. WaiKit writes the code and I replay it and explain what he did.
In this drive by code session we’ll show you what a context-free grammar is and how to use it and Nearley to build parsers. JSON is used as the example language we’ll build the parser for.
In this drive by code session we continue making a JSON parser. After having make a working parser for a subset of the functionality in JSON, we’ll introduce the ability to embed JavaScript code in the grammar to customize the result of a parse. Again, Waikit wrote the code, and I’ll replay them and explain what he did. Enjoy!
In this drive by code session we’ll demonstrate how to handle whitespaces in a grammar using Nearley.js. The convention used in the video is based on the recommendations by Kartik Chandra - the creator of Nearley.js. As usual, Waikit drove the code before hand, and I’ll replay his code session and explain what he did.
Watch “Make a Parser With Nearley.js - Part 3 - Handling Whitespace”
In this episode we’ll demonstrate how to parse a string literal in JSON properly, continuing our series on building parsers using Nearley.js.
Watch “How to Make a Parser with Nearley.js - Part 4 - Parsing String Literals”
Continuing in the series on making parsers, this time, we build a calculator that can add, subtract, multiply and divide. In particular, we tackle the issue of operator precedence.
Watch “How to Build a Parser with Nearley.js - Part 5 - Operator Precedence”
In this episode we’ll implement parenthesis for overriding operator precedence in our arithmetic syntax. This is a continuation of the Nearley.js series for build parsers using JavaScript. Waikit wrote the code, and I replay his session and explain what he did.
In this episode we’ll add function expressions to our arithmetic syntax and Toby was force to go off script as Waikit forgot to implement the power functions. We’ll see if Toby holds it together. Again we’ll use Nearley.js as the parser generator.
In this episode, Waikit and I show you how to have your parser produce an AST - short for Abstract Syntax Tree. Also, I will answer a YouTube comment! Enjoy.
Watch “Make a Parser with Nearley.js - Part 8 - Making ASTs”
In this drive by session Waikit and I continue our journey of building a baby programming language. Previous we created a parser that generates a AST representation of the code. Now we’ll write an evaluator that takes that AST as input and evaluates the result of the program.
In this drive by code session WaiKai and I show you how to write a code generator: a program that spits out JavaScript code based on the AST (abstract syntax tree) of our small math arithmetic language.
I introduce a project that I’ve been working on: the Fun Programming Language. This project has 2 purposes: 1) to teach developers functional programming by allowing to choose between the functional style and the imperative style explicitly and enforcing it; 2) to give programming language learners a reference language to play with.
In this video I’ll introduce how to use the Moo.js lexer/tokenizer with Nearley.js. A lexer is a processing step commonly used to process the input string before the parser. It helps increase the performance of the parser, and as in the case of Moo.js, it also allows the parser to report errors with line number information.
In this video I introduce the Earley Parser Algorithm and explain how it works with a small parsing example. The Earley Algorithm was invented by Jay Earley and is used by the nearley parser generator tool which I have covered in previous videos.
In this video, a follow up to the introductory video on the Earley Parsing Algorithm, I explain how Nearley.js produces user-friendly error messages whenever a parser error is encountered.
Watch “Generating Friendly Parser Errors with Earley Algorithm”
This is the first episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang.
This is the second episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we begin building the parser for the programming language, starting with variable assignment syntax.
This is the third episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we write implement the ability parser function calls in the parser and modify the parser to be able to handle multiple lines of code.
This is the fourth episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we write a code generator that produces JavaScript, in JavaScript.
This is the fifth episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we write some runtime functions to allow users of the language to have a baseline of capability.
This is the sixth episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we write code to parse lambda functions: the most powerful feature of this language.
This is the seventh episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we add more proper whitespace handling to the language and run into some trouble, but nothing we can't debug our way out of.
Watch “Make Your Own Language 7: White Space and Ambiguous Grammar”
This is the eighth episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we make the code generator for lambda functions and actually get the fibonacci series program to work!
This is the ninth episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, add comments and start on working a code challenge by get side-tracked on debugging some more ambiguous grammar.
Watch “Make Your Own Language 9: Comments and More Ambiguous grammar”
This is the tenth episode of a series where you build your first programming language, using these videos as a guide. We’ve setup the syntax for a small programming language. You can clone this project and start getting to work. The project repository is https://github.com/airportyh/smallang. In this episode, we struggle through the roman numerals coding challenge, and see if this programming language is worth anything.
I tell my story and show the results of improving the performance of the jsonr parser (github.com/airportyh/jsonr) written using Nearley.js. This video demonstrates parser code in a real world scenario and also gives performance tips regarding Nearley.js and beyond.
In this video I tell Huiqi about David Beazley's "Write a Compiler" course and X86 registers.
This is a 1-hour lecture and demo I did for Insiten's Algorithm Friyay. I introduce ASTs (Abstraction Syntax Trees), how to get them in JavaScript, and we write code to traverse an AST. Unfortunately I failed to record the audio for the attendees, so you can only hear one side of our conversations.
This is the second hour-long lecture on ASTs which I did for Insiten's Algorithm Friyay. We finish building a script that can tell which variables in a JavaScript program are unused by traversing an AST of the program.
I am starting a new series about compilers called Compilers Challenge and this is episode 1. For each "compilers challenge", first I will present a video with a problem for you to solve. You are to solve this code challenge at home. Then, in a separate video coming out about a week later, I will present my solution to the challenge. To get the most of this experience, I recommend that you give the challenge a faithful attempt before view my solution. The first episode is on Reverse Polish Notation: https://en.wikipedia.org/wiki/Reverse_Polish_notation. Here is the text of the challenge as it is written on leetcode.com: https://leetcode.com/problems/evaluate-reverse-polish-notation/. Good luck!
This is the solution to the first compilers challenge: Reverse Polish, which can be found here: https://tobyho.com/video/Compilers-Challenge-1-Reverse-Polish-Notation.html You can find all compilers challenges here: https://github.com/airportyh/compilers_challenge