I also built my own compiler (Heck an entire computer using logic gates - HDL) in nand2tetris. Luckily in the compiler the was no operator precedence so the user had to manually use parenthesis to tell the compiler the procedence!
@Logan-mj3wx26 күн бұрын
Yeah the parens route is definitely an option. I also like the trick I explain in the video lol. I actually want to do a course going from logic gates to something like an 8 bit computer. Thinking about the channel though I think I want to cover computation theory first -> maybe digital design -> assembly -> operating systems -> a whole lot of other crap lol.
@jordixboy25 күн бұрын
@@Logan-mj3wx I would definitively recommend nand2tetris I and nand2tetris II courses! its really awesome
@griffinschreiber686727 күн бұрын
so underrated.
@Logan-mj3wx26 күн бұрын
🥹
@flamechain9113Ай бұрын
Im impressed with how concise the code is, I modeled my compiler after Roslyn so there was a lot more bloat in the beginning I hope you continue the series, after adding classes to my language I've been wanting to see how other people would do it
@Logan-mj3wxАй бұрын
Oof classes are another animal🤣 i certainly didnt do it cleanly in a C++ compiler I made🤣 The code in this series actually largely comes from Thorsten Ball. He doesnt cover classes in his books but I would be shocked if he doesnt pick up the topic somehwere
@neurofleetАй бұрын
@@Logan-mj3wx classes are super simple, they don’t even have to exist at the language level! They’re in essence just array factories and array parsers (on a memory level), but it looks like in your case all it might take is to treat these environments you created as objects 🤔
@Logan-mj3wxАй бұрын
I think you're right. These environments could represent a class pretty well...
@selvamp5775Ай бұрын
Nice
@DocBolle2 ай бұрын
Just nitpicking: There is a copy error at 3:30. The type of the Boolean value should be "Bool(ean)" instead of "Integer". Nevertheless: I liked this video very much!
@Logan-mj3wx2 ай бұрын
Whoooops. Thanks for the correction!
@selvamp57752 ай бұрын
🙏👍
@selvamp57752 ай бұрын
👏👏👏 Excellent.
@chandankunal3 ай бұрын
Keep up the great work!
@selvamp57753 ай бұрын
👏👏
@LeaRomski3 ай бұрын
Banger bro keep going
@Logan-mj3wx3 ай бұрын
Thank you good sir!
@matthewbirk65754 ай бұрын
Loving these, please don’t stop 🫶
@Logan-mj3wx4 ай бұрын
Working on the last parser vid now! ❤️
@siavashabedi80295 ай бұрын
very great. It deserve more like and view
@Logan-mj3wx5 ай бұрын
Thanks a lot!
@selvamp57755 ай бұрын
Excellent 👏
@oleksandrtashno65416 ай бұрын
I like the leading ((( approach. Might not be the fastest but it’s such a shortcut…
@SimGunther6 ай бұрын
1:53 Oops! The assignment operator returns a value, but that's not how you add two numbers together.
@Logan-mj3wx6 ай бұрын
Lol typo 🤦♂️ Unfortunately + and = share the same key. Nice catch!
@someonesalt50846 ай бұрын
It's such a coincidence that we're both following Thorsten Ball's Compiler in Go book at the same time. you sound chill af, do you have discord or anything I can connect with you on?
@Logan-mj3wx6 ай бұрын
@someonesalt5084 course thusfar is a mismash of him + some other resources I have found useful. He doesn't stray very far into CFGs which is a shame. Im looking to do more on that once the code is written. 90% of the code is from the book directly. Discord is girthquake6440
@tomatte996 ай бұрын
Great!!! I love zombie games and would love to make one someday, probably starting with 2D.
@Logan-mj3wx6 ай бұрын
Ill get back to this at some point! Zombies was just magic in a bottle!
@tomatte996 ай бұрын
I wrote a parser for creating a simple version of a bash, it was challenging, but I did not get into the expressions part, now I know it would be 10x harder if I had to.
@Logan-mj3wx6 ай бұрын
You should finish it! Luckily we dont have to derive these techniques ourselves, we can now just implement them🙂
@stolvey6 ай бұрын
I'm in the middle of writing a parser and ran into a wall when I had to deal with operator precedence. Then I found this series! Can't wait for more videos!
@kvsbcsljv6 ай бұрын
all my man needs is a better mic and the quality is gonna be top
@Logan-mj3wx6 ай бұрын
Lol the struggle is real
@LambdaCreates6 ай бұрын
first comment 4th like 100th view
@SimGunther7 ай бұрын
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 😊
@marmont80057 ай бұрын
Nice video bro <3
@Logan-mj3wx7 ай бұрын
Thanks my dude
@SuperDrKongo7 ай бұрын
Great videos❤
@James-zn8nz7 ай бұрын
BTW, I decided to go with a lightweight custom Trie datastructure implementation for my tokenizer, and its working great. I am currently matching for operators/keywords, identifiers and number literals simultaneously, and picking the longest with a preference for operators/keywords. Is this a good approach?
@Logan-mj3wx7 ай бұрын
Absolutely it is a good approach, and I imagine it is quite a bit cleaner than the good ol fashioned switch block. Personally I havent approached it that way yet :)
@James-zn8nz7 ай бұрын
@@Logan-mj3wxIt certainly looks nice, and I'm using a macro to instantiate my token trie and enum. Although the latter process of selecting between operators/keywords, number literals and identifiers has a bit to go before i could call it a pretty sight.
@James-zn8nz7 ай бұрын
3:14 what about a layout-insensitive language, without braces, brackets or dedentation to define scope...
@James-zn8nz7 ай бұрын
I'm actually working on a grammar for this, but chances are I will use dedentation for nested constructs :( The important part is leading every statement with a keyword/operator
@Logan-mj3wx7 ай бұрын
If you want to have scope you would have to define it somehow, be it by keyword, file, spacing, etc. Otherwise the program would have to be in a global scope.
@James-zn8nz7 ай бұрын
@@Logan-mj3wxIt's a simple ML/OCaml inpired language, and every statement is prefixed by either a keyword or an operator, which means the compiler could understand scope based on expansion rules. Still there are issues with nested structures as if you were saying that every time a `let` keyword is encountered it is a new statement, then a nested function would not be possible. This particular example can be overcome with lambdas, but other constructs like cases may have to have dedentation.
@Logan-mj3wx7 ай бұрын
@@James-zn8nzAwesome stuff, you are braver than I to create something that is closer to lambda calculus. I love OCaml though, every couple months I apply to Jane Street I want to work with it 😂
@James-zn8nz7 ай бұрын
@@Logan-mj3wxFunctional languages actually seem quite easy to build. No mutability means simple functions and composition means simple production rules. I'm sure it'll be more difficult than that though. Initially there will be no complex typing system, just the built-ins, however I do plan on building some dependant type magic at some point. Also, I have written a lot more Haskell than OCaml, but I prefer some of the OCaml syntax to Haskell's. In particular, it's the indentation-sensitivity that I don't like. Also, not having to repeat the name of my function tens of times is quite nice.
@CSDex7 ай бұрын
Good stuff
@codysoultz91247 ай бұрын
You should majorly zoom in on the code text to take up most of the space as it is really hard to see text on a phone screen. Other than that great videos.
@Logan-mj3wx7 ай бұрын
Yeah im trying to find a good balance. Phones are tough🤣
@cosmowanda64607 ай бұрын
By the way, you haven't added this video to your compilers playlist. Awesome content! Do you plan to go through parsing and code gen?
@Logan-mj3wx7 ай бұрын
Absolutely going to go through parsing! In terms of code generation, we will execute the code and make a full interpreter, as for optimizing the source code given...probably not.
@James-zn8nz7 ай бұрын
These videos are great, easily digestible.
@Logan-mj3wx7 ай бұрын
Thats the plan! No marathon tutorials
@James-zn8nz7 ай бұрын
Currently coding my own lexer, and I'm struggling to figure out the best way to handle multi-character operators. Preferably, I would like to do this without using nested match statements (/switch statements). Other alternatives have been finding the longest matching prefix, or searching though a Trie, however these seem OTT and I haven't seen anyone else doing it this way. What would you suggest?
@Logan-mj3wx7 ай бұрын
Ill cover this in my next video on Tuesday.. The way I have chosen to do it in this course for multi-character tokens is an if inside of the switch. Not the prettiest, but good for beginners. Ill reply with a link to two lexers I have written in Go/C++
@cosmowanda64607 ай бұрын
@@Logan-mj3wxLet me know when you reply 👋🏽
@fltfathin7 ай бұрын
Never actually wrote it but if i do it i'd make state machine and decide what token to add to token list depending on what the next character match to. Tracking current state, current token text, and next character in every loop. its simpler to write if you think about the flow as railroad diagram and try to make state machine out of it.
@tylerlaceby7 ай бұрын
Use regular expressions. This is by far the easiest way to handling Lexing. You can construct an array of regular expressions and handlers.
@Ma1ne27 ай бұрын
Awesome content, great speed, clear explanations, keep it coming!
@Logan-mj3wx7 ай бұрын
Thank you! ❤️
@xetta88057 ай бұрын
this is super informative, thanks
@Logan-mj3wx7 ай бұрын
Glad you think so!
@pjp135797 ай бұрын
this is the simplest explanation I ever heard. I'll be following up!
@Logan-mj3wx7 ай бұрын
Thank you good sir, that is the finest compliment anyone trying to teach can receive :)
@Blaisem7 ай бұрын
I'm interested. One point of feedback is the 1 minute empty outro is confusing.
@Logan-mj3wx7 ай бұрын
Lol my bad, the music track I used extended the video. Thanks for the heads up!
@reynardlee36677 ай бұрын
very nice!! excited
@aaldorabi255010 ай бұрын
fractals are beautiful
@NashiaLePeguuin11 ай бұрын
I now really want this game!
@akshatmaurya3964 Жыл бұрын
as someone making a low poly air combat game, I can say with absolute certainty that this exactly how I make shit in unity, and that making the terrain is somehow more painful than making the aircraft fly in the first place
@Logan-mj3wx Жыл бұрын
Oh ya by far, i actually just switched to Unreal and am getting back into game content
@StraightEditz69 Жыл бұрын
Nice
@Logan-mj3wx Жыл бұрын
I will start the slander. I apologize for the small editor, will fix this in future vids, please see the repo in the description for the code 🥲
@Logan-mj3wx Жыл бұрын
Aforementioned slander can occur here. Or lavish praise, lavish praise is nice...
@yaaannn8126 Жыл бұрын
Logan Paul is so smart now a days
@MadSki11s2 жыл бұрын
What's up man! You could add a defense mechanism for the plane to scatter flash explosions in short range in order to detonate incoming missiles early, negating some of the 'damage'. Games with quickly moving projectiles built a lot of depth easily thx to Physics. Take baseball or any sports/e-sports. Keep up the good shit dude!
@Logan-mj3wx2 жыл бұрын
That is a solid idea! Now that im a little more comfy I actually want to remake this into a much more complete, polished game. Stay tuned!
@MadSki11s2 жыл бұрын
@@Logan-mj3wx Yeah, that's great! You don't have to quit unity btw, at least the reason you stated in the latest video didn't sound critical enough. There are some tangible networking solutions for multiplayer games like this one: kzbin.info/www/bejne/bJy6f42Fe8h5h9k
@martinson12522 жыл бұрын
@Logan kzbin.info/www/bejne/aarYc4J4aLulec0
@abelarce79302 жыл бұрын
hey bro! do you have advance about this project? i'm in a similar game dev. maybe we can exchange knowledge =)