[06] Recursive Decent Parsing - Data Oriented C Compiler

preview_player
Показать описание
Starting on recursive decent parsing and finally getting pretty tests working.

This series is incrementally building a C Compiler in C using Data Oriented Design as simply as we can.

A few ways to support me making videos and software for the community:

Рекомендации по теме
Комментарии
Автор

There is a good publicdomain header-only library stb for C that implements StringView, hash-map and dynamic array. It could greatly simplify lever and parser code, what do you think?

alexloktionoff
Автор

Can you tell more about 'peek token' advantages? Why not just use 'next token' to advance and keep 'previous' token in a local var and pass it to parser functions, won't it be faster?

alexloktionoff
Автор

But wait, AST must generate semantic/type checker, not a parser isn't it?

alexloktionoff
Автор

Good use of test cases although recursive decent seems very ugly. Doing it that way though seems like it'll be portable to the new cpu design, if you're going that far. I'm more of a fan of LALR(1) which happens to be very data oriented. It does require tooling for action/goto tables. I've also decided to take my javascript compiler-compiler and move it to Rust. (Also building cpu designs, and need more complicated test cases).

kuroikenjin
Автор

Where is Data orientation here? AFAIK lexer must provide simple INT token and functions/macros to get all necessary info /*like location, actual name e.t.c*/ blazingly fast using data locality structure of arrays e.t.c...
If you need original "source" to get some info from a token isn't it "data orientation" violation?

alexloktionoff
join shbcf.ru