StackLang Part IX: Better Testing

Two posts in two days? Madness! Posts in StackLang: StackLang Part I: The Idea StackLang Part II: The Lexer StackLang Part III: The Parser StackLang Part IV: An Interpreter StackLang Part V: Compiling to C StackLang Part VI: Some Examples StackLang Part VII: New CLI and Datatypes StackLang Part VIII: Compiler Stacks StackLang Part IX: Better Testing But really, it got a bit late yesterday so I figured I’d split this into two different posts.

read more...


StackLang Part VIII: Compiler Stacks

Let’s continue StackLang Part VII: New CLI and Datatypes and implement lists stacks in the compiler! Posts in StackLang: StackLang Part I: The Idea StackLang Part II: The Lexer StackLang Part III: The Parser StackLang Part IV: An Interpreter StackLang Part V: Compiling to C StackLang Part VI: Some Examples StackLang Part VII: New CLI and Datatypes StackLang Part VIII: Compiler Stacks StackLang Part IX: Better Testing In this post:

read more...


StackLang Part VII: New CLI and Datatypes

Another day, another Stacklang! Posts in StackLang: StackLang Part I: The Idea StackLang Part II: The Lexer StackLang Part III: The Parser StackLang Part IV: An Interpreter StackLang Part V: Compiling to C StackLang Part VI: Some Examples StackLang Part VII: New CLI and Datatypes StackLang Part VIII: Compiler Stacks StackLang Part IX: Better Testing Today, we’ve got two main parts to work on: A new CLI New datatypes (VM only; so far!

read more...


StackLang Part VI: Some Examples

We’ve gone through all sorts of things building up the StackLang language so far: Posts in StackLang: StackLang Part I: The Idea StackLang Part II: The Lexer StackLang Part III: The Parser StackLang Part IV: An Interpreter StackLang Part V: Compiling to C StackLang Part VI: Some Examples StackLang Part VII: New CLI and Datatypes StackLang Part VIII: Compiler Stacks StackLang Part IX: Better Testing But what can we actually do with it?

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...


Cloning Redis in Rust: RESP [Part 1]

Recently, I read through Build Your Own Redis with C/C++. C/C++ are ugly, so let’s run through it in Rust!

My goal: implement some large subset of Redis (both server and client) in Rust. For any features I implement, it should be compatible with Redis off the shelf. I should be able to use their client with my server and their server with my client and it should just work.

No idea if this is going to work out, but it sounds like an interesting problem!

First task: the REdis Serialization Protocol (RESP).

read more...