Programming, Topic: Assemblers

All posts

Recent posts

Building a virtual CPU from NAND gates up

Over the past couple of weeks, I’ve spent entirely longer than I probably should have falling down the rabbit hole that is the game Turing Complete.

In a nutshell, you start with basically nothing, build up simple logic gates, create memory cells and 1-bit addition, build that into 8-bit math and logic, read instructions RAM, implement loops, and function calls (in hardware!), and eventually use your very own custom built CPU to solve a few programming challenges.

read more...


StackLang Part II: The Lexer

StackLang, part 2: lexing.

It’s quite often the simplest part of implementing a programming language (although parsers for s-expression based languages come close), but it’s still something that needs done. So here we go!

read more...


StackLang Part I: The Idea

I enjoy writing programming languages. Example: Tiny. Let’s do that again.

This time, StackLang:

{
  @[n fact]
  1
  { n 1 - $fact fact n * }
  N 1 <= if
} @fact

5 $fact fact writeln

Bit of gibberish there, I suppose, but the goal is to write everything in a postfix/stack based model. So n 1 - $fact fact n * is equivalent to fact(fact, n - 1) * n in a more traditional language.

Over the next few posts, I hope to write up where I am thus far and what’s next.

read more...