Introduction To Parsers

preview_player
Показать описание
The next step for creating our own language is to write a parser.

Parsers will take the input from our lexer and create a tree data structure. While it does this it will also validate the source code against the grammar of our language.

In this video, I briefly introduce the concept of a grammar. We get an idea of how our source code breaks down into repeatable patterns, or grammar. Grammar rules break down into terminals and non terminals which we can correlate with our tokens.

Next up, we will begin to flush out these concepts little by little and start writing source code as we go along!

Like, subscribe, and share!
Рекомендации по теме
Комментарии
Автор

In a traditional parse tree, the left leaf holds the expression evaluating the conditional while the right leaf holds a node with a choice of either left (affirmative) or right (alternative), which could hold statement blocks.

Great to see this is simplified for illustrative purposes, but node data in a flattened manner instead of JSON data does wonders for a "real" parser 😊

SimGunther