Growing a Parse Tree (Compiler Pt.2)

preview_player
Показать описание

Keyboard: Keychron V6, Gateron G Pro V2 Brown Switches
Рекомендации по теме
Комментарии
Автор

After watching so much "clean code" and "good standards" and "being production ready" in youtube, this feels refreshing. A down to earth coding session for a fun project.

zokalyx
Автор

2:35 This does work, however `&&` in bash will only execute the second command (your echo) if the exit code of the first program is `0`. In your case the exist code is `2`. For this use case, you want to use a semicolon (`;`) instead of `&&` to chain the commands, to have your `echo` run regardless of the first programs exit code.

TimeTechnology
Автор

I think the function peak has to be renamed peek at both files, since peak means the top and peek means to look ahead.

dhanushg
Автор

19:18 Bjarne once said: "There are only two kinds of languages: the ones people complain about and the ones nobody uses"

zokalyx
Автор

To be honest this is a great video. I have a ton of experience from software development but I never tried to make my own compiler. This guy just goes at it. "it's just another program" love the mentality that nothing is too hard to do.

henrikholst
Автор

I really hope you continue this series! its been so fun to stumble along with you

Rubyboat
Автор

This is one of the most interesting series I've seen on Youtube. Just perfectly paced, understandable, great presentation. Thank you.

PreRenderedRealities
Автор

In your Peek() functions, you're not using the 'ahead' value when retrieving the character/token using the .at() function. This could lead to some problems down the road, if it isn't already. Also, afaik from previous attempts at doing this sort of thing, it's a good practice to make sure there's a new-line at the end of the file when you load it (or just add one to the loaded text) so your tokenizer doesn't miss the final token. Could be worth looking into. Loving these videos though!

logixthedev
Автор

This series is so much fun and so interesting. It makes me feel so smart

nikkehtine
Автор

The fun to come in parsing is that infix/prefix expressions (why would anyone do postfix in current year?) is done via pratt parsing while statements are parsed via recursive descent or GLR.

Wish you good luck and don't let the modern C++ features bring you down!

SimGunther
Автор

This Video series is a great source of learning. Thanks for making. Keep Uploading More Videos like this

tedlasso
Автор

Loving these videos, as someone who enjoys tinkering and making their own strange languages it's fun! I would say, do you not think for the nodes instead of prefixing with Node it would look better post-fixed with Node? Such as ExitNode, ExprNode. Also, exit in C is defined in cstdlib and is a function (that the compiler does funny things to when it is using due to there being no way to actually express an exit). Maybe lexing and parsing a function call would be better in the long run here. FnCallNode could contain a vector<ExprNode> and then it scales a bit. Then you can just hardcode checks for the function name for now to mess. Anyway, good video bro keep em coming

keykeyjean
Автор

I love these vid. i just finished the last one. it was the perfect video to watch after taking the final to computer system and architecture. biggest part of our final project was writing an assebler, so your vid felt perfect to watch next

dimabelya
Автор

I am just binge watching a dude going insane 😂 love the videos on the compiler

benewolf
Автор

this is a great series, i just finished the last video, excited to watch this one

rz
Автор

commenting second part lessgo

didn't found any other sussy timecodes
44:20 malloc & free
29:40 lisp langs looks like perfect AST example, they even don't need much explanation: (display (+ 1 (* 69 (- 10 2))))
11:50 void type exists for no return
10:43 yay my sugesstion from part 1 was mentioned
8:40 you can return '\0' char

eldyj
Автор

Hey! Nice explanation dude! This vids should become more rated!

old_cd_rom
Автор

yo this series is awesome. i love programming

unthinkabilities
Автор

Lol "an abstract syntax snake". Great video, but If one is serious about wanting to learn to write programming languages I recommend learning to compile to C or LLVM. Both of those are cross platform and will generate fast code. Assembly is cool, but really niche at this point and creates countless platform headaches. Btw for those who are scared of C++ one can still write a compiler in python or javascript, and when that is done one can make the compiler self-compile. The best languages IMO for doing this is F# or Rust both have advanced pattern matching and great debugging and testing frameworks.

torarinvik
Автор

Nice video:) never tried doing something like this but might just try myself sometime. Some small things I noticed;
Modern C++ prefers stringviews over passing const string references. This prevents any copies being made.
And since this is a video about writing a compiler… splitting your header files and impementation (CLion can do that quickly for you) can speed up your compilation of your compiler dramatically 😛

nepp