|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/essentials-of-parsing/
课程评论:没有评论
课程名称:解析算法 课程概述: 解析或语法分析是设计和实现编译器的第一阶段之一。一个设计良好的编程语言语法是用户选择你语言的重要动机。然而,传统编译器学校和书籍中对于“解析器理论”的讲解常常被视为“过于高级”,直接进入复杂的形式化描述,导致学生在解析阶段就失去兴趣。而另一些描述解析器的方式则过于肤浅,仅介绍手动(通常是递归下降)解析,从而使学生难以理解自动解析器背后的实际技术。 本课程采用深入的解析理论与实践相结合的方法,重点讲解LL和LR解析器,并同时从零开始构建一个类似于JavaScript或Python的全编程语言的自动解析器。完成本课程后,学员不仅能够使用解析器生成器构建编程语言的解析器,还能理解解析器生成器的工作原理,提升对其他编程语言的实际使用能力。 适合人群: 本课程适合任何对构建复杂系统感兴趣的工程师,尤其是对编译器、解释器和源代码转换工具有兴趣的人。要求的基础知识包括基本的数据结构和算法,如树、列表和遍历。 实现工具: 课程中所构建的语言与JavaScript或Python的语义非常相似,因此使用JavaScript进行实现。我们使用Syntax工具生成自动化解析器,这是一种语言无关的解析器生成器,支持多种编程语言,如Python、Ruby、C#、PHP、Java和Rust。学员将亲自实现而不是简单复制最终答案,课程还提供了完整的语言源代码和视频讲解,指导如何构建特定模块。 课程特点: - 简洁明了:每节课内容独立,直接描述相关信息,不偏离主题。 - 动画演示与实时编辑结合,增强理解。 - 从头到尾的实时编码会话及作业,呈现完整源代码。 课程内容: 课程分为四个部分,共22节课,涵盖多个小主题: 1. **上下文无关文法与语言**:描述不同的解析流水线,讲解形式文法、推导、模糊和不模糊文法,并开始构建编程语言。 2. **自顶向下的LL解析**:详细讨论自顶向下的解析,介绍手动递归和回溯解析器,深入讲解LL(1)解析算法。 3. **自底向上的LR解析**:描述自底向上的解析器和LR解析算法,同时继续构建编程语言,分析并解决移位-归约冲突。 4. **实践与最终解析器**:完全实践的部分,完成Letter编程语言的构建,包括变量、函数、循环、控制结构、面向对象编程和最终解析器的实现。
Course overviewParsing or syntactic analysis is one of the first stages in designing and implementing a compiler. A well-designed syntax of your programming language is a big motivation why users would prefer and choose exactly your language.-----------------------------The problem with "parsers theory" in classic compiler schools and books is that this theory is often considered as "too advanced", going right into complicated formal descriptions from the Theory of Computation and formal grammars. As a result students may lose an interest in building a compiler already at parsing stage.The opposite problem often seen in describing a parser is a superficial approach describing only manual (usually recursive descent) parsing, leaving the students with issues understanding the actual techniques behind the automated parsers.-----------------------------I believe this deep dive into the parsing theory should be combined together with a hands-on approach, which goes in parallel and allows seeing all the learned theoretical material on practice.In the Essentials of Parsing (aka Parsing Algorithms) class we dive into different aspects of the parsing theory, describing in detail the LL and LR parsers. However at the same time to make the learning process and understanding easy and fun, we build in parallel an automatic parser for a full programming language, similar to JavaScript or Python, from scratch.After this class not only you will be able to use a parser generator to build parsers for programming languages, but will also understand how the parser generators work under the hood themselves.Implementing a parser for a programing language would also make your practical usage of other programming languages more professional.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 parser for a programing language is a pretty advanced engineering task!), and obtain a transferable knowledge for building such systems.If you are interested specifically in compilers, interpreters, and source code transformation tools, then this class is also for you.The only pre-requisite for this class is basic data structures and algorithms: trees, lists, traversal.What is used for implementation?Since we build a language very similar in semantics to JavaScript or Python (the two most popular programming languages today) we use specifically JavaScript - its elegant multi-paradigm structure which combines functional programming, class-based, and prototype-based OOP fits ideal for that.Many engineers are familiar with JavaScript so it should be easier to start coding right away. To generate the automated parser we use Syntax tool which is a language-agnostic parser generator, and supports plugins for Python, Ruby, C#, PHP, Java, Rust, etc. That is, the implementation of this parser can easily be transferred to any other language of your choice and taste.Note: we want our students to actually follow, understand and implement every detail of the parser themselves, instead of just copy-pasting from final solution. The full source code for the language is available in video lectures, showing and guiding how to structure specific modules.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 (and when at time) 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 video lectures of the classWhat is in the course?The course is divided into four parts, in total of 22 lectures, and many sub-topics in each lecture. Below is the table of contents and curriculum.Part 1: Context-free grammars and languagesIn this part we describe different parsing pipelines, talk about formal grammars, derivations, what is ambiguous and unambitious grammar, and start building our programming language.Part 2: Top-down LL parsingIn this part we talk in detail about Top-down parsing, describing manual recursive and backtracking parser, and also dive into the LL(1) parsing algorithm.Part 3: Bottom-up LR parsingIn this part we describe Bottom-up parsers and LR parsing algorithm. In parallel we continue building our programming language, analyzing shift-reduce conflicts and fixing them.Part 4: Practice and final parserThe final part of the course is completely practical, we're finishing our Letter programming language, building variables, functions, loops, control structures, object-oriented programming, and the final parser.