Some Syntactic Sugar We are going to be talking about some pretty high level concepts in this post, like true and false and maybe even the natural numbers (although that might be too high level and need to be left to the next post). You've probably realised that the Lambda Calculus has no means of … Continue reading Higher Level Concepts In The Lambda Calculus
Blog
Computation With The World’s Smallest Programming Language
Update: The latest version of the lambda calculator has line editing and a command history. It's more convenient than the version linked in the blog and is tagged 0.1.0. Note to the reader: much of this post is based on an article I found on the web called Lambda Calculus (part I). That article covers … Continue reading Computation With The World’s Smallest Programming Language
The World’s Smallest Programming Language
Update: The latest version of the lambda calculator has line editing and a command history. It's more convenient than the version linked in the blog and is tagged 0.1.0. Introduction The world's smallest programming language is probably the Lambda Calculus. The Lambda Calculus was invented by Alonzo Church in the 1930's as a means of … Continue reading The World’s Smallest Programming Language
The Forth Protocol
In which I accidentally discover a performance enhancement I'm really not a fan of the massive switch statement at the heart of the execution loop, so I have decided to see if I can do something with virtual functions or closures on a WordList. The execute function would be reduced to running a particular function … Continue reading The Forth Protocol
RE-Evaluating Forth
In which I take another crack at the evaluation cherry Just a short post to note that I have finally cracked evaluate. After the refactoring exercise, I still had a number of issues mostly caused by the design decision to put the currently interpreting word in the word list at position 0 and to use … Continue reading RE-Evaluating Forth
Forth Refactored
In which my head exploded so I had to simplify things Because my Forth interpreter is effectively event driven i.e. the input parser parses and then calls the interpreter to interpret one word, it gets very complicated when an executing word needs to pull something off the input parser. It has to exit the interpreter … Continue reading Forth Refactored
Evaluating Forth
In which I evaluate some strings The evaluate word is next on the list of core tests. This allows a Forth program to evaluate a string as if it were another Forth program. The simplest way to implement this would seem to be to implement a stack of sequences of input characters. evaluate then simply … Continue reading Evaluating Forth
Defining Forth
In which I try to unify the defining expressions. There are a number of ways to add words to the dictionary. These include: :, create, constant, and variable. It seems to me that the "primitive" should really be to just add the word to the dictionary and then each of the above words can be … Continue reading Defining Forth
Forth does create
In which we have to reimplement create and does>. Having implemented create and does> as described previously, there are two problems. Consider the following extract from my core tests: t(": DOES1 DOES> @ 1 + ;", expected: "") t(": DOES2 DOES> @ 2 + ;", expected: "") t("CREATE CR1", expected: "") t("CR1 here =", expected: … Continue reading Forth does create
Does Forth create
In which my head explodes. create and does> are what is currently causing the unit tests of my Forth interpreter to fail. So what do these things do? Well, if you read the Forth specification, it becomes obvious that the main thing they do is make a nice smoothy out of your brain. Fortunately, I … Continue reading Does Forth create