ANTLR with PHP: Type Inheritance, Visitors, Listeners, and AST Construction Step by Step
Автор: Kunusoft
Загружено: 2026-02-01
Просмотров: 16
Описание:
In this video, we implement two key examples using ANTLR and PHP. First, we build a grammar for type list declarations with inherited attributes, following figure 5.8 from the book. We define tokens, generate the parser, and use the visitor pattern to propagate and process types correctly.
In the second part, we implement figure 5.10, where instead of evaluating expressions, we construct an Abstract Syntax Tree (AST). Using listeners, stacks, and custom node classes, we generate a DOT representation that can be visualized with Graphviz tools.
⏱️ Timestamps:
0:00 Fig. 5.8 Type List implementation with visitor
0:20 Grammar definition
1:00 Evaluation visitor implementation
2:30 Index.php implementation
2:50 Testing integer and float declaration
3:00 Fig. 5.10 AST Construction with Listeners
3:20 Grammar definition
4:20 Node.php implementation
4:40 Tree.php implementation
5:30 AST Listener implementation
6:50 Index.php implementation
7:20 Two type error correction
7:40 Testing expresion and DOT output
7:50 AST Visualization with Edotor
8:00 Final words
#compiler #php #antlr #parser #lexer #ast #grammar #grammarrules
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: