DIY Programming Language #1: The Shunting Yard Algorithm

preview_player
Показать описание
In this video I demonstrate how the Shunting Yard Algorithm works, and produce a simple implementatin to solve basic mathematical expressions like a calculator would.

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

So are you BODMAS, or PEDMAS, or something else?

javidx
Автор

i've been writing code for almost 30 years and im still learning new things. thank you so much

ModernVintageGamer
Автор

During the first 8 minutes I was thinking: You know he is a programmer when he does not need a computer to program! Thumbs up!

psodq
Автор

Dude, I started following your stuff when I was a junior dev. Almost 10 years have passed, nice to see you still make great content.

ovndfbs
Автор

Just as a callout to people who learn alternatives such as PEMDAS and BIDMAS - the order of multiplication and division doesn't matter - they have the same precedence and are just done from left to right together. The same with addition and subtraction. You can swap M/D and A/S if you feel more comfortable that way, but these are within the scope of this video the only pairs that are interchangeable as of right now!

kplays_
Автор

In school, we were taught "Please Excuse My Dear Aunt Sally" as the acronym for the order of operations.
Also, another word for value is operand. For instance, in 4 + 5, the "+" is the operator and "4" and "5" are the operands.

Barnardrab
Автор

Just got into the Pixel Game Engine and happy to see you still making content! Thanks for everything you do for the community, you are appreciated!

TheSelfUnemployed
Автор

My mind was blown when I combined Recursive Descent statement parsing and Pratt expression parsing constructed with compile time curried functions. Great analysis of this expression parsing algorithm!

SimGunther
Автор

Custom programming languages are an interesting topic that plagued my mind for years! Great to see you covering this

antonpieper
Автор

I never knew that it was called the shunting yard algorithm. I still remember that creating a calculator was one of the first programs I had to write while studying 35 years ago.

landmanland
Автор

programming language development on this channel, I'm all for it!!

catapillie
Автор

25:50 The answer is 2 but not for the reason given: multiplication and division have the same priority so they are evaluated left-to-right, so: 1x(2+4)/3 = 1x6/3 = 6/3 = 2. The same for addition and subtraction.

ZFan
Автор

Always, Aaalways I come back to Javid channel I learn something new! Thank you so much for all!

PabloSanchez-them
Автор

The master has returned. Always good to see amazing content with value from you and the community.
Keep it up javid, and congratulations on X10 growing health:)

vitoralmeidasilva
Автор

This video is priceless, thank you. A few observations- the brackets have higher precedence (i.e.3 plus) therefore the precedence of the subtraction operator becomes 3 plus by association with the brackets. You do not need to assume the bracket is 0... The brackets are made redundant at the point of output as no longer needed, as the order of the solve stack clarifies the order of operation at this point.

stardustfinancial
Автор

I love how eloquent you are explaining alien stuff like this.

Sam-huxt
Автор

This was a fantastic educational video! Thank you for your time with this one. Very excited to see what comes next in the series!

ryanlarge
Автор

It has been a while since I last watched one of your videos, it feels like meeting with an old friend after a long time.
Now I miss programming c++

petacardi
Автор

Familiar algorithm, well explained -- good job! One thing you might have added is why it's called the "shunting yard algorithm", because it can be explained by analogy to shunting railway wagons in a yard in such a way as to build a train in the necessary order. In that analogy, only one stack is generally used (though another is needed for evaluating the solution, though in fact it can be the same stack with a bit of cunning).

GRAHAMAUS
Автор

Maybe I misunderstood the code but at 10:00 if '+' has higher precedence than '-' then wouldn't 1 - 2 + 3 be evaluated as 1 - (2 + 3)? That would be unusual, IME. Plus and minus normally have the same precedence and would be evaluated left-to-right.

ablonix