Building a Typechecker from scratch

所在平台: Udemy

课程主页: https://www.udemy.com/course/typechecker/

课程评论:没有评论

第一个写评论        关注课程

课程简介

课程名称:从零开始构建类型检查器 课程概述: 未类型化的程序往往容易出现错误、运行时异常,并且会使调试变得更加困难。因此,许多生产语言实现了静态类型检查器,旨在提高程序的安全性并简化开发过程。课程将探讨一系列相关问题,例如类型检查与类型推断的区别、类型理论与类型判定的概念、语言是弱类型还是强类型,以及如何实际实现一个类型检查器。如果你曾经在编程语言的实现中遇到这些问题,或者想理解类型检查器的底层工作原理,这门课将非常适合你。 该课程与一般的类型理论或类型判定书籍不同,这些书籍往往侧重于理论方面,将类型视为数学集合,而未深入探讨如何构建实际的类型检查器。课程内容直接切入要点,通过对偶编程的直播编码环节,让学员在2到4小时内构建一个完整的静态类型检查器,类似于TypeScript、Java等语言。 实现类型检查器的过程将提升你的工程水平,因为它涉及数据结构与算法的多个方面。 适用人群: 本课程面向任何希望掌握复杂系统构建技能的工程师。尤其是对编译器、编程语言及类型理论感兴趣的学员,也适合想为自己编程语言构建类型检查模块的人。 实现工具: 课程将使用JavaScript进行类型检查器的实现,尽管有些人认为需要使用某个与类型较为相关的编程语言。实际上,JavaScript作为最受欢迎的编程语言,简单精炼的实现使其对许多工程师更为可及,且该代码可移植到你所选择的任何语言中,如TypeScript、Rust、OCaml、C++、Python等。 课程特色: - 课程内容简洁明了,每节课都自成体系,直接与主题相关。 - 动画展示结合实时编辑笔记,帮助理解复杂内容。 - 从零开始的全编码直播环节,学员需要亲自实现每一个细节,而非单纯复制黏贴。 课程结构: 课程分为四个部分,共20节课,内容包括但不限于以下主题: 第一部分:类型理论与基本类型 - 介绍类型理论、类型检查与类型推断,建立类型检查器基础,实施变量,讨论类型环境,构建解析器。 第二部分:函数式编程 - 集中于不同类型的函数,包括用户定义函数、内置函数、内嵌函数和闭包、递归函数以及匿名Lambda表达式。 第三部分:类型声明与类 - 实现用于定义新类型的构造,包括类型别名和面向对象编程的类。 第四部分:泛型编程 - 讨论联合类型,并实现泛型函数。 通过该课程,你将获得构建类型检查器的知识和实践经验,提升你的编程和工程技能。

课程评论(0条)

课程详情

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.

课程标签

0人关注该课程

主题相关的课程