Building a Parser from scratch

所在平台: Udemy

课程主页: https://www.udemy.com/course/parser-from-scratch/

课程评论:没有评论

第一个写评论        关注课程

课程简介

课程名称:从零开始构建解析器 课程概述:解析或语法分析是设计和实现编译器的首要步骤之一。一个设计良好的程序语言语法是吸引用户选择使用该语言的重要因素。该课程是一个关于构建手动递归下降解析器的实践课程。递归下降解析器是实际应用中广泛使用的一类解析器,与自动解析算法相比,手动实现使得在解析过程中可以完全掌控,处理复杂结构的能力也更强。通过从零开始实现完整的手动解析器,学员可以深入理解这一过程,揭示内部结构,使构建解析器变成一项有趣的工程任务。 在本课程中,学员将深入学习递归下降解析的概念,了解什么是词法分析器以及其如何与解析器模块协作,学习抽象语法树(AST)的不同格式,理解“前瞻”和预测解析,最终构建一个类似于Java或JavaScript的完整编程语言解析器。实现解析器将使学员对其他编程语言的实际使用更加专业。 目标对象:该课程面向任何有好奇心的工程师,希望掌握构建复杂系统的技能,特别适合对编译器、解释器和源代码转换工具感兴趣的学员。课程的先修知识包括基本的数据结构和算法,如树、链表、遍历和正则表达式。 实现工具:由于所构建的语言在语法上与JavaScript或Java相似,因此使用JavaScript进行开发。JavaScript的多范式结构结合了函数式编程与基于类和基于原型的面向对象编程,非常适合本课程需求。此外,由于JavaScript被广泛使用,学员可以更轻松地开始编码。 课程特点:该课程的主要特征包括:讲解简洁明了,每节课都自成体系,内容直接与主题相关;结合动画演示和实时编辑笔记,以易于理解复杂主题的方式展示对象结构连接;提供从头到尾的实时编码示范和作业,完整源码在视频讲座中呈现,指导如何结构特定模块。 课程内容:课程分为四个部分,共18节课,涵盖多个子主题。 第一部分:基本表达式和词法分析器 描述基本表达式,如数字和字符串,构建操作正则表达式的词法分析器模块。 第二部分:程序结构 讨论程序结构,例如语句和语句列表、代码块和递归生成规则,解析不同的AST格式,并开始构建更复杂的表达式。 第三部分:控制流与函数 实现变量、赋值、运算符优先级,介绍函数抽象,定义控制结构如条件语句和迭代循环。 第四部分:面向对象编程 在课程最后一部分实现类与对象,探讨属性和数组访问,构建通用函数和方法调用,并完成最终的解析器可执行文件。

课程评论(0条)

课程详情

Parsing 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.Note: this is a practical class on building a manual Recursive-descent parser. If you're interested in parsing theory and automated algorithms you may also consider the [ Parsing Algorithms ] class.​Recursive descent parsers are the group of parsers which are widely used on practice in many production programming languages. In contrast with automated parsing algorithms, the manual implementation allows having full control over the parsing process, and handling complex constructs, which may not be possible in the automatic parsers.Besides, implementing a full manual parser from scratch allows understanding and seeing this process from inside, demystifying internal structures, and turning building parsers into an interesting engineering task.In the Building a Parser from scratch class we dive into pure practical implementation, building and learning different aspects of parsers.In this class you will learn concept of Recursive descent parsing, understand what is Tokenizer and how it cooperates with Parser module, learn what is Abstract Syntax Tree (AST), and how to have different formats of these ASTs, what is "lookahead" and the predictive parsing, and eventually build a parser for a full programming language, similar to Java or JavaScript.Implementing a parser 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 pre-requisites for this class are the basic data structures and algorithms: trees, lists, traversal, and regular expressions.What is used for implementation?​Since we build a language very similar in syntax to JavaScript or Java 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. However we do not use very JS-specific constructs, so the implementation of the parser can easily be transferred to any other language of your choice.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 class​What is in the course?The course is divided into four parts, in total of 18 lectures, and many sub-topics in each lecture. Below is the table of contents and curriculum.​Part 1: Basic expressions and Tokenizer​In this part we describe basic expressions, such as Numbers and Strings, and also build the Tokenizer modules, operating with regular expressions.​Part 2: Program structure​In this part we talk about program structures, such as statements and statement lists, blocks and recursive production rules. In addition we discuss different AST formats and start building more complex expressions.​Part 3: Control flow and Functions​In this part we implement variables, assignment, work with operator precedence, and introduce function abstraction. In addition we define control structures such as If-statement and iteration loops.​Part 4: Object-oriented programming​The final part of the course we implement classes and objects, talk about property and array access. In addition we implement generic function and method calls, and build the final parser executable.​

课程标签

0人关注该课程

主题相关的课程