@@user-sl6gn1ss8p the paper he's probably referring to is "Top Down Operator Precedence" by Douglas Crockford, 2007. But that paper only rehashes what Pratt talked about in the 1973 paper.
IIRC my formal languages classes, while simpler to understand, the "problem" with "recursive descent parser" is you have to write it by hand, while the "shift reduce" ones can be generated automatically from the language specification using tools like yacc, GNU bison, etc., also they can be used with a wider range of grammars, that's why they're more interesting (alas, the wikipedia page on recursive descent parser has a paragraph explaining exactly that, with more formal references, in the introduction)
I've come up with infix-to-postfix parser after watching "How easy operator precedence is" (I guess I didn't fully understand it the first time), but this method looks more flexible, although the core idea is the same (decide whether to call procedure recursively depending on a change of precedence). I don't like explicit trees (maybe because I haven't really encountered them in work), maybe that's why postfix form felt more natural to me, and this one is more about creating AST.
I wrote a boolean logic parser recently, and I wish I had come across this before. This sounds so much simpler to implement when the strings happen to include nested instructions. I don't like the idea of it being recursive though, so I'd probably make a vector and push intermediate values to it, then shift through that while len > 0.
@@OzmandisMandis recursion has a depth limit. can be increased, but is there. if you use a vector (heap) you're freer. iirc. not 100% sure but pretty much that is it
@@phitc4242 that's true but for parsing you're not gonna get to that point anytime soon as expression are not really that deep, you can also change the stack size if you really need to.
I guess if you look at the asm output you'd know more... I'm no expert tho. but in the end it's an instruction similar to "call [address/label]". the arguments are on the stack I think. or if it's not too many, I'd put them into rax/rbx/rcx/etc... but then again, I'm no pro, I've just dabbled in asm a teeny tiny bit
@@phitc4242 yeah and there’s a cost to that (pushing a bunch of stuff to the stack), so i was wondering if it was related to that or something. but i guess compiler authors have already spent a shit-ton of thought on that, so maybe there’s not that much new to invent there but on the other hand, different languages and different architectures have different calling conventions, so there’s already some variety there. for example, do you put some arguments in registers, as you mentioned? do you allow multiple return values, etc
? 8:00 Isn't this basically the same thing as tree traversal, it's just the comparison made is between numbers instead of... states. So you can sort of do a one-to-one analogy and realize it's the same thing. number > number for this. state vs state for the other system.
@@OzmandisMandis Wow, thanks! I didn't expect anyone to get back to me. I'll have to read about Pratt parsing and... probably study algorithms. I just started programming C and learning TCP/IP stuff. Learning programming is overwhelming.
@@coolguy69verycool i feel the problem is to cut through so much bs....thats something i never have in mech eng....i got gaslit with the OO-religion decades ago...its so interesting to come back to programming now..they now shit on everything i was told is the best thing ever...J.Blow is one of the most brutal. it makes me hope i was nt crazy in the end when i stayed away from higher level stuff until now...
@@simonschneider5913 Ya, I first started dabbling when people started calling themselves "React developers" and I was buying in hard to that idea. I'm now fully committing to learning how computers work and how to be a good developer while acknowledging that those "React developers" were the people that were laid off.
Bro Jonathan Blow said it, so it must be true. He's the patron saint for people who want to be programmers but don't want to go to school for it. Being right isn't as useful as being confident.
Faces, names, contexts, words, topics, identities. Past, present, future. Transient, permanent. I just don't get the human concept, their fixations, their attentions, what moves them within and without, this tangled world they are all part of.
what confuses you is the intelligence that allows one to discern, make sense of the world and navigate the world effectively. If you mean what you said literally and not as a pseudointellectual quip, seek a neurologist. I have never heard of an adult who doesn't have an understanding of object permanence - researchers would be very interested in you.
I'm surprised someone as opinionated as him doesn't just go all in and say "do it in postfix." Honestly I wouldn't mind a language that only uses postfix for math.
"Jonathan Blow on Calling Functions" these titles are so funny, it's always like "Jonathan Blow on" and then the most mundane thing ever
For this vid the title doesn't feel correct to me, so I wonder why they chose it
lmao yeah I kept wondering how this guy has an opinion on literally everything, then I watched the video and it made a lot of sense.
Jonathan Blow on Breathing
on the next episode "Jonathan blow on writing hello world"
Bruh, calling a function seems mundane only cuz were abstracting away the complexity
next up "Jonathan Blow on drinking water"
There was a clip of him praising a water filter. So that's actually a good guess.
Top Down Operator Precedence
Vaughan R. Pratt
Massachusetts Institute of Technology 1973
that doesn't sound too recent tho : p
But thanks for the pointer : )
@@user-sl6gn1ss8p Most of computer science is also not that recent. Still holds true though, since it boils down to math.
@@delphicdescant yeah, it's just that in the video they mention a recent paper
@@user-sl6gn1ss8p the paper he's probably referring to is "Top Down Operator Precedence" by Douglas Crockford, 2007. But that paper only rehashes what Pratt talked about in the 1973 paper.
@@igstan Oh, thanks : )
This title is a reverse click bait. Expected some things about function points, arguments on stack, etc. but ended up with building AST.
The technique of checking for current precedence and whether to recurse or not is also used by Thorsten Ball in his books
inb4 jon and casey on how easy operator precedence is
It's literally the most trivial thing. I'm actually shaking right now because of how ****** easy operator precedence is!
Didn't they do that a few weeks ago :p
it looks like he's going into the basic function of recursive descent compilers. Which is not exactly operator precedence, but
This is how I've always done it and I haven't looked up how others have done it
IIRC my formal languages classes, while simpler to understand, the "problem" with "recursive descent parser" is you have to write it by hand, while the "shift reduce" ones can be generated automatically from the language specification using tools like yacc, GNU bison, etc., also they can be used with a wider range of grammars, that's why they're more interesting (alas, the wikipedia page on recursive descent parser has a paragraph explaining exactly that, with more formal references, in the introduction)
The file name is "asdfasdf" that's so real, he is but a man, no longer enshrined as a God
This man's name is just perfect setup for deez nuts jokes.
I've come up with infix-to-postfix parser after watching "How easy operator precedence is" (I guess I didn't fully understand it the first time), but this method looks more flexible, although the core idea is the same (decide whether to call procedure recursively depending on a change of precedence). I don't like explicit trees (maybe because I haven't really encountered them in work), maybe that's why postfix form felt more natural to me, and this one is more about creating AST.
why not "jonathan blow on operator precedence"
from his thumbnails this guy look like Dave Bautista but in shape
I wrote a boolean logic parser recently, and I wish I had come across this before. This sounds so much simpler to implement when the strings happen to include nested instructions.
I don't like the idea of it being recursive though, so I'd probably make a vector and push intermediate values to it, then shift through that while len > 0.
If you think about it, the call stack is just a fast access vector
May you share your reasons of why you dislike it being recursive ?
@@OzmandisMandis recursion has a depth limit. can be increased, but is there. if you use a vector (heap) you're freer. iirc. not 100% sure but pretty much that is it
@@phitc4242 that's true but for parsing you're not gonna get to that point anytime soon as expression are not really that deep, you can also change the stack size if you really need to.
It's really the same. Heap vs stack.@phitc4242
Why not include a link to the source video in the video description?
i was hoping he would have actual opinions on the very concept of functions and how they are implemented in most compilers or something like that
same here.. ;)
I guess if you look at the asm output you'd know more... I'm no expert tho.
but in the end it's an instruction similar to "call [address/label]". the arguments are on the stack I think. or if it's not too many, I'd put them into rax/rbx/rcx/etc... but then again, I'm no pro, I've just dabbled in asm a teeny tiny bit
@@phitc4242 yeah and there’s a cost to that (pushing a bunch of stuff to the stack), so i was wondering if it was related to that or something. but i guess compiler authors have already spent a shit-ton of thought on that, so maybe there’s not that much new to invent there
but on the other hand, different languages and different architectures have different calling conventions, so there’s already some variety there. for example, do you put some arguments in registers, as you mentioned? do you allow multiple return values, etc
What is the original date on these?
does he use emacs without line numbers?
I thought this is solved by building trees. At least it's how I do this.
?
8:00 Isn't this basically the same thing as tree traversal, it's just the comparison made is between numbers instead of... states.
So you can sort of do a one-to-one analogy and realize it's the same thing.
number > number for this.
state vs state for the other system.
I'm very ignorant to both topics but this kinda sounds like the shunting yard algorithm but applied differently. If I'm way off, please let me know
you're not too far off, it's called Pratt parsing and it's an "augmented" version of shunting yard.
@@OzmandisMandis Wow, thanks! I didn't expect anyone to get back to me. I'll have to read about Pratt parsing and... probably study algorithms. I just started programming C and learning TCP/IP stuff. Learning programming is overwhelming.
@@coolguy69verycoolyou're welcome. I wish you a great journey.
@@coolguy69verycool i feel the problem is to cut through so much bs....thats something i never have in mech eng....i got gaslit with the OO-religion decades ago...its so interesting to come back to programming now..they now shit on everything i was told is the best thing ever...J.Blow is one of the most brutal. it makes me hope i was nt crazy in the end when i stayed away from higher level stuff until now...
@@simonschneider5913 Ya, I first started dabbling when people started calling themselves "React developers" and I was buying in hard to that idea. I'm now fully committing to learning how computers work and how to be a good developer while acknowledging that those "React developers" were the people that were laid off.
How is the shunting yard algorithm recent
Bro Jonathan Blow said it, so it must be true.
He's the patron saint for people who want to be programmers but don't want to go to school for it.
Being right isn't as useful as being confident.
Since when did Jonathan Blow become the end all be all lmao
Faces, names, contexts, words, topics, identities. Past, present, future. Transient, permanent. I just don't get the human concept, their fixations, their attentions, what moves them within and without, this tangled world they are all part of.
Get some help
what confuses you is the intelligence that allows one to discern, make sense of the world and navigate the world effectively.
If you mean what you said literally and not as a pseudointellectual quip, seek a neurologist. I have never heard of an adult who doesn't have an understanding of object permanence - researchers would be very interested in you.
I'm surprised someone as opinionated as him doesn't just go all in and say "do it in postfix."
Honestly I wouldn't mind a language that only uses postfix for math.
Who are you? These titles looks like you are some kind of IT guru
Next up Jonathon Blow on why he Blows
Next week, Jonathan Blow on pressing 3. You're never going to guess what happened next!