Study Learn Grow
Building A Parser From Scratch

Building A Parser From Scratch


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.

Overview

Description
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.

Recursive descent parsers are the group of parsers that are widely used in 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 the inside, demystifying internal structures, and turning building parsers into an interesting engineering task.

In the Building a Parser from the scratch class we dive into pure practical implementation, building and learning different aspects of parsers.

In this class, you will learn the concept of Recursive descent parsing, understand what is Tokenizer and how it cooperates with the 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 in building complex systems (and building a parser for a programing language is a pretty advanced engineering task!), and obtain 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.
If you took or going to take a class on Building an Interpreter from scratch, the parsers class can be a syntax frontend for the interpreter built in that class.

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 the 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 an understanding of the topics easier and shows how (and when at the time) the object structures are connected. Static slides simply don’t work for 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 a 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

In the final part of the course, we implement classes and objects, talk about property and array access. In addition, we implement a generic function and method calls and build the final parser executable.
Basic knowledge
Basic data structures and algorithms

Course Information

Basic data structures and algorithms

Recursive descent parsers
Build a parser for a full programming language
Top-down parsing
Abstract Syntax Trees (AST)
Different AST formats
Left-recursion
Tokenizer and Tokens
Regular Expressions spec

This class is for any curious engineer, who would like to gain skills in building complex systems (and building a parser for a programing language is a pretty advanced engineering task!), and obtain 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.

• Lifetime Access to Each Course
• Certificate on Completion of Course
• No Extra Charges Or Admin Fees
• Easy Access to Courses
• High Priority Support After Sales.
• Big Discounts on Individual Courses

Course Specifications

Plan your future in engineering with courses including MSc Engineering Management.

See All Courses

Adult education is the non-credential activity of gaining skills and improved education. 

See All Courses

Online education is electronically supported learning that relies on the Internet for teacher/student interaction. 

See All Courses

A short course is a learning programme that gives you combined content or specific skills training in a short period of time. Short courses often lean towards the more practical side of things and have less theory than a university course – this gives you a more hands-on experience within your field of interest.

See All Courses

Course duration is 24 hours.

See All Courses

Study Learn Grow

Related Jobs