Tuesday, December 11, 2018

The Shunting Yard algorithm

The picture on the left is a stack computer that compiles rings onto another stack.  We have a three stack system to the left, input stack,  temporary stack and output stack.

The game gives us an idea on the difficulty of traditional arithmetic  parsers, not too.

Forth uses one of these machines, mostly implemented in digital.  They have a return stack and data stack, plus the implied input stack.  Look closely at their code, they have routines like: Swap left and right rings, or push ring onto center post. In fact, they shout it out, like in capital letters even.

You can see what software geeks call precedence in operators, they mean the rings have to be in order of size, larger at the bottom.  One could actually label these rings and write forth code with them, like emulating a printing press with ncurses.

I like using analogies to the simple things in life, hen folks get that this software stuff is more like carpentry with typewriters keys. I mean, look a those three rings, seriously the inspiration for Forth and the shunting algorithm.  Computer professors need to bring this to class.

I learned this stuff once, when younger, then forgot about it.  But these analogies, type writers, morse code, Tower of Hanoi, hey all  act as skeletons above which I recover a memory of this stuff.  Memories, really an interaction between the brain and environment, both needed to repeat actions from the past.  There is sometimes job  mismatches in software, employers looking fr specific skills at the particular moment, forgetting transaction costs.  The software pros see the designs in most compilers, parser and languages, they do not try to remember.  Right now, it would take me a day to get back to speed on Python. But there are some key analogies I made when doing the stuff, and when I actually go back, I will bring to mind some cardboard box, or wooden thins, so some analogy that I remembered fit the concept.

That is also te key to Alpha, they have a skeleton, the tree of game rues, and they have a complex channel to fill efficiently. That is how we build singularity, we get it up to the level that the bots can spot the skeletons, with humans helping.

No comments: