Fork me on Github

[#15] Poor Man's FORTH

This puzzle was contributed by Jia Wu and Gregory Brown and published on November 15, 2011

Eddie the Esoteric Programmer has enlisted your help in making a new stack based programming language. He claims it's going to be the next big thing, even if others keep telling him it pretty much looks like a poor man's FORTH. While you are fairly certain that Eddie is more crazy than brilliant, you are giving him the benefit of the doubt because he has promised to give you a lifetime supply of free LOLCODE consulting if you are successful in helping him.

Eddie has already sketched out a few example programs and even has a few unit tests describing how his language should work. He has given you the source code for both sample programs as well as the tests, but has only provided the expected output for one of the samples. He claims this is because he does not trust anyone except LOLCODE programmers, and wants some proof that you actually know what you are doing.

Your Task

In order to gain Eddie's trust, you need to implement an interpreter for his language which supports all the features found in his challenge.stack program. He claims that if you read the stacker_test.rb file as well as the sample.stack and sample_output.txt file, you should have no trouble hacking together something that will meet his expectations.

Note that Eddie's unit tests include some features that aren't used by challenge.stack at all. While Eddie would be thrilled if you built a more complete implementation of his language, you will sufficiently impress him by providing a text file that matches what he'd expect to see as the output of the challenge.stack program.

Beyond giving you these files to work with, Eddie has not provided any additional details. He claims that this is for your own good, but refuses to elaborate further.