Forth Amendment

In which I comment on things Define words ( and ) in Forth. Make ( read words until ) and do nothing with them. This is how Forth implements comments. I didn't quite follow the prescription above. I found that gforth will happily parse things like 3 ( 4 hgfd) . and (in this case) return 3. So it is not a case … Continue reading Forth Amendment

Go Forth and Multiply – or Don’t

In which I provide my Forth machine with the ability to make decisions Now it is time to revisit branching. Provide builtin branch and branch? words. We'll first need to do some refactoring because, in order to jump somewhere, our list of instructions needs to be indexable. In fact, it needs to be bidirectionally indexable. The branch instruction will … Continue reading Go Forth and Multiply – or Don’t

May the Forth be With You – Programs

In which I create a state machine and compile simple programs but I don't implement branches Provide builtin branch and branch? words. Seems simple enough... ... oh wait, how can I branch somewhere if I don't have the concept of a program, or a list of words at the least. I'll create the words for now, but I won't … Continue reading May the Forth be With You – Programs

May the Forth Be With You – The Dictionary

In which I create a dictionary of words and an interpreter This is series of posts based on a blog by Andreas Zwinkau. Exercise 2 Create a dictionary of some sort. Initialize it with the words + and print. Execute programs like 2 3 4 + + print. This is where things get interesting. Prior to the exercise, Andread … Continue reading May the Forth Be With You – The Dictionary

Pandemic Two – Self Isolation

Previously, I wrote a simple pandemic simulation. Now I have extended it to model self isolation measures. To do this I changed the model in the following ways: the virus has an extra property which is the period immediately after infection for which the patient is asymptomatic.The population now has two levels of sociability: one … Continue reading Pandemic Two – Self Isolation