Building a Typechecker from scratch

via Udemy

Go to Course: https://www.udemy.com/course/typechecker/

Introduction

Certainly! Here's a comprehensive review and recommendation for the Coursera course on building a typechecker: --- **Course Review and Recommendation: Building a Typechecker from Scratch on Coursera** Are you interested in understanding how programming languages ensure safety and correctness through static type checking? Do you want to learn how to build your own typechecker, similar to those used in languages like TypeScript, Java, or C++? If so, this Coursera course is a perfect match for you. **Course Overview:** This practical, hands-on course dives into the core concepts of type theory, type checking, and inference, focusing on the actual implementation of a static typechecker. Unlike traditional courses that often lean heavily on theoretical aspects, this course emphasizes building a fully functioning typechecker step-by-step, from scratch, in just 2-4 hours of focused, live-coded content. **What You Will Learn:** - The fundamentals of type theory, type judgments, and type inference. - How to implement a parser, typing environment, and core typechecking logic. - Handling various types, from basic primitives to complex user-defined types and classes. - Advanced topics like generics, union types, and type aliases. - Practical skills applicable in building safe, reliable programming language systems. **Key Features:** - Concise and focused lectures that skip unnecessary fluff. - Animated presentations combined with live coding to clearly illustrate data structures and algorithms. - End-to-end live coding sessions with assignments to reinforce learning. - Code snippets in JavaScript, demonstrating that building a typechecker does not require a language specifically designed for type theory—making it highly accessible. **Prerequisites:** While prior knowledge isn't mandatory, familiarity with building interpreters or understanding of programming language concepts (like abstract syntax trees, closures, environments, and evaluation) is recommended. For beginners, taking a course on interpreters beforehand may enhance the learning experience. **Who Should Enroll:** - Software engineers and programmers interested in language design, compilers, or static analysis. - Students and professionals wanting to deepen their understanding of type systems. - Anyone curious about how complex systems like type checkers work internally, aiming to gain transferable skills for building robust software tools. **Why You Should Take This Course:** This course uniquely balances theoretical insights with practical implementation. Its focus on building a real typechecker in JavaScript—even though the concepts are applicable across languages—means you'll gain both conceptual understanding and hands-on experience. The interactive approach, with live coding and assignments, ensures you can follow along and implement every part of the system yourself. **Final Verdict:** If you're looking to move beyond just understanding the theory of types and want a clear, guided path to building your own typechecker, this course comes highly recommended. It demystifies a complex area of computer science with clarity and practicality, making it accessible for motivated learners eager to enhance their engineering skills. --- Feel free to enroll and start your journey into the fascinating world of type systems and language design!

Overview

Course overviewUntyped programs are often prone to errors, runtime exceptions, and can make debugging much harder. That's why many production languages implement a static typechecker - an extra module, which is aimed to increase programs safety and make development simpler.Type checking or type inference? What is Type theory and Type judgements? Is my language weakly or strongly typed? And how am I actually going to implement a typechecker?There are so many questions when it comes to implementing this module. If you've been asking those questions in implementing your programming language, or just want to understand how typeckechers work under the hood, on a hands-on practical implementation, this course is for you.-----------------------------Often related books on Type theory and type judgements go to theoretical aspects viewing types as mathematical sets, not explaining how actually to build a practical typechecker. I believe we should be able to build and understand a typechecker for a full programming language, end-to-end, in 2-4 hours - with a content going straight to the point, showed in live coding sessions as pair-programming and described in a comprehensible way.In the Building a Typechecker from scratch class we focus specifically on a static typechecker, and build a similar to TypeScript, Java, etc. We slightly touch Type theory and already since the first lecture go into the practical implementation.Implementing a typechecker would also increase your engineering level, as it touches several aspects of data structures and algorithms.PrerequisitesAn optional prerequisite for this class is the Building an Interpreter from scratch (aka Essentials of Interpretation) course, where we build an AST-interpreter for a full programming language. Unless you already have understanding of how programming languages work at this level, i.e. what eval, a closure, a scope chain, environments, and other constructs are - it is recommended to take the interpreters class as a prerequisite.Who this class is for?This class is for any curious engineer, who would like to gain skills of building complex systems (and building a typechecker for a programming language is an advanced engineering task!), and obtain a transferable knowledge for building such systems.If you are interested specifically in compilers, PL and Type theory, and want to build a typechecker module for your programming language, this class is also for you.What is used for implementation?Sometimes people think that to build a typechecker you certainly need to use some programming language which is itself "very related to types and type theory" (such as OCaml of other functional programming languages). But actually no! You can build a fully working typechecker in plain JavaScript, and cover all the aspects of the Type systems. And this is exactly what we use for implementation.JavaScript, being the most popular programming language, should be accessible for many engineers, and also our goal is to provide a simple and concise implementation, not focusing on specifics of a host language. So the code should be portable to any language of your taste and choice: TypeScript, Rust, OCaml, C++, Python, etc.Note: we want our students to actually follow, understand and implement every detail of the Typechecker themselves, instead of just copy-pasting from final solution. Even though the full source code for the typechecker is presented in the video lectures, the code repository for the project contains /* Implement here */ assignments, which students have to solve.What's specific in this class?The main features of these lectures are:Concise and straight to the point. Each lecture is self-sufficient, concise, and describes information directly related to the topic, not distracting on unrelated materials or talks.Animated presentation combined with live-editing notes. This makes understanding of the topics easier, and shows how the object structures are connected. Static slides simply don't work for a complex content.Live coding session end-to-end with assignments. The full source code, starting from scratch, and up to the very end is presented in the video lecturesWhat is in the course?The course is divided into four parts, in total of 20 lectures, and many sub-topics in each lecture. Below is the table of contents and curriculum.PART 1: TYPE THEORY AND BASIC TYPESIn this part we start talking about Type theory, type checking and type inference, and also build the foundation of our typechecker. We establish the basic types, implement variables, talk about Typing Environment, and build a parser.PART 2: FUNCTIONAL PROGRAMMINGIn this part we focus on different types of functions - user-defined, built-in functions, inner function and closure, recursive function and anonymous lambda expressions.PART 3: TYPE DECLARATIONS AND CLASSESIn this part we implement constructs aimed to define new types. Topics of type aliases and OOP classes are considered.PART 4: GENERIC PROGRAMMINGIn this part we continue with type declarations, and talk about Union types, and also implement generic functions.

Skills

Reviews