K4 Blog
Search K4 Blog
Meet K4
K4 was born as a pure C++ implementation of a stack based language. We are developing K4 to run modest embedded hardware. We believe it provides us with:
A low-cost (to develop and to deploy) language.
It requires little memory and is fast for what it does.
It is very extensible by its dictionary based defining words (functions)
And we get the freedom to shape the language as we develop it.
K4 is like FORTH (https://en.wikipedia.org/wiki/Forth_(programming_language). However our K4 is not an implementation of FORTH, nor of its cousin STOIC or for that matter any other particular stack based language. K4 is Bored Owl’s own language, which borrows heavily from this heritage, but is to suit the needs of our own systems for example Eddie.
Our K4 blog will gradually take you through the process of developing the language especially in relation to Project Eddie.
Our K4 wiki on github is where we are building the documentation for K4. This is our K4 wiki: https://github.com/boredowl-public/K4/wiki#welcome-to-the-k4-wiki
A simple K4 example
In this post, I will present a very simple K4 example that you can follow along and run yourself.
The example is a simple guessing game. The program picks a random number between 1 and 100. The player guesses the number then the computer tells them if its too high, too low or just right. It also counts how many guesses you made to get your answer.
K4 now
In the last post we covered some basics on how K4 accepts input, looks up words in a dictionary executes them and even how new words are defined. In this post I’ll talk about what K4 has been developed for, and how you could run it for yourself.
I want to develop this Blog as a story of K4. This project has been going now for about six months. The language was prototyped in C++ (on OSX) and has been ported to Linux, our ESP32 BOB boards and ATSAMD51 (ARM Cortex-M4+) CPU’s in our EDDIE project. Work is underway to put a miniaturized version on ATSAMD21 (Cortex-M0) CPU’s we use.
Experiencing K4 First Hand
K4 is an esoteric language. That does not mean it is difficult. In our case - it matches the uses we put it too very well.
K4: An old language for a new machine
I’m coming back to my roots building embedded systems in my time at Bored Owl. As much as I love software, having a connection to actual hardware the switching of things and measuring stuff makes computers relevant and important. My projects have involved making new hardware and ultimately writing software to get that hardware going.
Embedded hardware has come a long way in 45 years. I started writing and manually loading assembly language programs - compilers were an expensive luxury in more ways than one. Not only did you have to afford the compiler and development system but also generally larger and more expensive target hardware to run it on.
Now for a few tens of dollars and an evening on the internet, a 32bit 200MHz processor will run Micropython and empower you in so many ways.