RSSAmplifier

Blog

Dusty Phillips Codes

Recent content on Dusty Phillips Codes

dusty.phillips.codesRSS feed ↗91 posts

Latest posts

Portable Computing Setup

I know from experience that if I use a laptop keyboard for any length of time,
I will be forced to do voice coding for months
while the RSI heals. 
 Therefore I don’t own a laptop. For the past five years this has meant I’m
chained to my desk if I want to do any coding or computing (though a tablet
and pencil have been my go-to for non-typing tasks such as easy…

Some Gleam Projects

I spent most of my winter break in my wood shop, working on some tech adjacent
projects that I will post about later. However, I also spent a fair amount of
time at my keyboard, working on a handful of gleam projects I wanted to
introduce here. 
 I’m theoretically working on a small full stack application, but as so often
happens with me, I was sidetracked by developing…

My AI-Driven Identity Crisis

I love coding. I love writing. I love writing about coding, as evidenced by
the archives of this blog and the multiple tech books I have written. 
 I’ve always prided myself on being able to explain things clearly. I have a
unique ability to identify the order in which to teach concepts. I have enough
five star reviews on my books to know that there are plenty of readers…

Build a Wasm Compiler in Roc - Part 16

In earlier articles , we have implemented a
tokenizer, parser, and transformer to convert WAT syntax to a Wasm AST,
and got started on the code generation. 
 In this part, we’ll finally wrap up code generation and be able
to compile our hello world sample into something that wasmtime 
can run. 
 I hope.

Build a Wasm Compiler in Roc - Part 15

In earlier articles , we have implemented a
tokenizer, parser, and transformer to convert WAT syntax to a Wasm AST,
and got a good portion of the code generation step in place. 
 Unless there are any unexpected detours, this part will cover more code
generation and take us through a messy refactor that Roc helpfully makes not so
messy!

Build a Wasm Compiler in Roc - Part 14

In earlier articles , we have implemented a
tokenizer, parser, and transformer to convert WAT syntax to a Wasm AST
and got started on the code generation. 
 This part will continue with code generation. We’ll start with the import
section because it has a couple interesting complications that we need to
take into account. 
 The Import Section 
 Consider this wat…

Build a Wasm Compiler in Roc - Part 13

In earlier articles , we have implemented a tokenizer, parser, and
transformer to convert WAT syntax to a Wasm AST, and started building a code
generator to create bytes from that AST. The structure of the code generator is
in place already, so our remaining task is to generate all the other sections
of our input module. 
 Data section 
 The next section I want to implement…

Build a Wasm Compiler in Roc - Part 12

In earlier articles , we have implemented a
tokenizer, parser, and transformer to convert the Web Assembly Text Format to
an Abstract Syntax Tree that can hopefully easily compile to Wasm. 
 Truthfully, the next step should be validation. Validation is the process of
statically analyzing the syntax tree to catch as many errors as possible. This
is where things like type…

Build a Wasm Compiler in Roc - Part 11

In earlier articles , we implemented a
tokenizer and parser to convert Wasm’s WAT syntax into an S-expression abstract
syntax tree and
started to implement a transformer to convert that AST into one more
suitable for generating Wasm bytecode. 
 This article continues where we left off, building the last piece of the
transformer. This piece needs to represent arbitrary…

Build a Wasm Compiler in Roc - Part 10

In earlier articles , we implemented a
tokenizer and parser to convert Wasm’s WAT syntax into an S-expression abstract
syntax tree and started to implement a transformer to convert that AST into one more
suitable for generating Wasm bytecode. 
 Now that the boilerplate is in place, this article will continue to implement
recursive transformer functions, getting into some…

Build a Wasm Compiler in Roc - Part 9

In earlier articles , we implemented a
tokenizer and parser to convert Wasm’s WAT syntax into an S-expression abstract
syntax tree, and
started to implement a transformer to convert that AST into one more
suitable for generating Wasm bytecode. 
 This article continues where part 8 left off, as we try to expand the parser
to something more than an empty WAT (module) .…

Build a Wasm Compiler in Roc - Part 8

In earlier articles , we
implemented a tokenizer for the Wasm text syntax (WAT) and started on
a parser to convert those tokes to a S-expression AST. 
 In this part, we’ll start to create a transformer to convert that AST to a
new one that better matches the WASM output we will be crafting. Don’t ask me
how many parts that’s going to take! 
 
…

LazyVim for Ambitious Developers Now Available

It’s been a while since I published the last chapter of LazyVim for Ambitious
Developers on the website ,
but I was waiting for the print edition to be available to share it widely. And
that required waiting (twice) for proofs to be mailed to me. 
 But it’s finally here! For a direct link to purchase the print edition, click
here . 
 I’m proud of the book…

Build a Wasm Compiler in Roc - Part 7

In earlier articles , we
implemented a tokenizer for the Wasm text syntax (WAT). In part
6 , we started building
a parser. We ended that part on a bit of a down note when I realized
we were in for yet another refactor. I’m in a better mood today and it’s
looking like it won’t be so bad, after all! 
 
 Reminder: You are reading content that took a great…

Build a Wasm Compiler in Roc - Part 6

In earlier articles , I introduced this “WAT to Wasm compiler in Roc”
project, wrote some Roc code to load an input file, and implemented a tokenizer
for a “hello world” of Wat to Wasm compilation. It was… more work than I
expected. Four blog posts more work, to be precise! I have no idea where it’s
going to end. 
 But I do know what’s…

Build a Wasm Compiler in Roc - Part 5

In earlier articles , I introduced this compiler project, wrote some
Roc code to load an input file, and started implementing a tokenizer with error
handling. 
 I think I need to admit that I have absolutely no clue how to estimate how long
a blog article is going to be. I thought “build a compiler” would be one
article. And then I thought “build a…

Build a Wasm Compiler in Roc - Part 4

In earlier articles , I introduced the project, wrote some Roc code to
load an input file, and started implementing a Tokenizer. 
 This part takes a bit of a detour with a refactor to support rudimentary error
reporting. 
 
 Reminder: You are reading content that took a great deal of effort
to craft, compose, and debug. If you appreciate this work, consider…

Build a Wasm Compiler in Roc - Part 3

In part 1 and
 part 2 of this series,
I introduced the project and we wrote some Roc code to load an input file and save
the compiled result to a different file. 
 Note: Other articles in this series are collected here . 
 However, we are a long ways from actually having that compiled result available!
This article introduces the phases involved in writing a compiler and…

Roc Articles

Table of contents for my series on building a WASM compiler in Roc : 
 
 Part 1 - Project Introduction (Roc and Wasm) 
 Part 2 - Arguments and IO in Roc 
 Part 3 - Tokenizer boilerplate 
 Part 4 - Errors and positions in tokenizer 
 Part 5 - Testing and tokenizing 
 Part 6 - Introduction to Parsing 
 Part 7 - Refactoring with confidence (more parsing) 
 Part 8 -…

Build a Wasm Compiler in Roc - Part 2

My latest hair-brained project is a WAT-to-Wasm compiler written in the Roc
programming language. I explained my (ir)rationale for the project in Part
1 of this
series, which also included an introduction to the technologies we’ll be using. 
 Note: Other articles in this series are collected here . 
 In this article, we’ll get started writing some Roc code. We…

Build a Wasm Compiler in Roc - Part 1: Introduction

I’ve been curious about the Roc programming
language for a while now, but I haven’t had/taken the time to really dig into
it. I’ve read through the tutorial several times, but only yesterday did I
actually sit down and install Roc and implement the tutorial. Today, I woke up
with the ridiculous idea to build a compiler in the language. 
 A simple compiler, to…

LazyVim for Ambitious Developers

I’m working on a new book! This one will be published online with plenty of
begging for support on my
 Patreon . If there is sufficient
interest, I’m planning physical and ebook editions later this year. 
 LazyVim for Ambitious developers is a book for the modal-editor-curious out
there. Vim and Neovim have a reputation for being hard to learn and…

Extolling the Virtues of Dexie Cloud for Backendless Development

Dexie Cloud was released publicly today, and I love this
product so much that I want to lend my voice to the marketing effort. 
 Dexie.js is an incredible library for interacting with
IndexedDB in the browser. It wraps the sometimes-obtuse (and oft-buggy)
IndexedDB APIs with much more developer-friendly interfaces. And it is fully
reactive; if you change something in the…

We Rewrote our React App in Svelte in Three Weeks

My wife and I have been working on Fablehenge —a
writing app for novelists—for several years. It had been a free time project
where we’d push hard over a few weekends, then let it sit idle for a couple
months perhaps tinkering in the evenings when we had a bit of time. 
 At the beginning of this year, I decided to take a sabbatical, which was
 supposed to involve cutting…

How Inko Does Safe Concurrency

In my last article on Inko, I implemented
several data structures to demonstrate how Inko’s single ownership model works. 
 In this article, I will expose a big lie in that article and also dive into how Inko safely handles concurrency. 
 Why Concurrency is Hard 
 Truth be told, concurrency is hard for a lot of reasons, but the one that comes up most often is concurrent…

Understanding Inko Memory Management Through Data Structures

I briefly described Inko’s unique memory management model in my previous article .
In this one, I want to go into a little more detail on single ownership and move semantics by implementing a few
linked lists, and a couple graphs. This is a tutorial about Inko and not about data
structures, so I am assuming that you have a passing knowledge of the data structures in question (or…

Why I'm Excited About Inko

I’ve spent much of my free time (if there is such a thing) over the past few years
researching various esoteric programming languages for no reason whatsoever. Some of my
favourites include Rescript and Gleam , which target
the Javascript and Erlang ecosystems, respectively. 
 But I’ve really been looking for something a little more native.
It seems to me that there…

Installing Inko 0.11 On Macos

UPDATE: I’ve updated the Inko Formula on Homebrew
to 0.11.0, so you may just want to use brew install inko instead. That said, There are a few bugfixes
on Inko that didn’t make it to the 0.11.0 release, so you may want to build off the main branch instead. 
 I have a blog article in progress about why I’m super excited about the Inko Programming Language…

How I Reconfigured Neovim From Scratch

Throughout my career, I’ve at least tried most of the available programming
editors. More than two decades ago, I heard about the vi-vs-emacs debate, and
made a pact with myself to use both for at least a year before deciding which I
preferred. 
 I started with vim, switched to emacs after a year, and decided I preferred
vim. I joined the sublime-text bandwagon for a year…

A Tutorial Introduction to Gleam -- Part 6

Introduction 
 This is the sixth in a series of articles exploring the
 Gleam programming language. In this one, I’m setting aside
my little password cracking project to look at gleam for frontend development. 
 I love Rescript for frontend development, it’s a very practical functional
programming language, and I’ve written a lot on the topic. So
this…

A Tutorial Introduction to Gleam -- Part 5

Introduction 
 This is the fifth in a series of articles exploring the
 Gleam programming language. In the most
recent article, we
started exploring how Gleam interfaces with ERLang’s powerful OTP concurrency
framework to brute force some passwords. However, it was suboptimal, partially
because I didn’t know what I was doing, and partially because I didn’t…

A Tutorial Introduction to Gleam -- Part 4

Introduction 
 This is the fourth in a series of articles exploring the
 Gleam programming language. The first
article explored some of
the most basic features of Gleam; just enough to say hello. The
 second discussed looping
constructs, namely that gleam doesn’t have them.
The third was supposed to
be about parallel programming and OTP, but it ended up being…

Gleam Articles

I’ve started a tutorial-style series on the Gleam programming language and wanted to collect them together here. 
 
 Part 1: Hello World 
 Part 2: Looping Without Loops 
 Part 3: Tail Recursion 
 Part 4: Parallel with OTP 
 Part 5: Better Parallel Processes 


A Tutorial Introduction to Gleam -- Part 3

Introduction 
 This is the third in a series of articles exploring the
 Gleam programming language. The first
article explored some of
the most basic features of Gleam; just enough to say hello. The
 second discussed looping
constructs, namely that gleam doesn’t have them. 
 This one was supposed to investigate how Gleam integrates with Erlang’s
famous…

Fast, Bare, Rescript React (2022)

( Original published September 30,
2021. Updated May 7, 2022) 
 Introduction 
 Most of my Rescript series so far has been about combining Rescript with React
using create-react-app. Now that I understand Rescript better, I’m not so sure
create-react-app is a good fit for it. 
 Mostly because it’s slow. Rescript compiles JSX natively, so we shouldn’t…

A Tutorial Introduction to Gleam -- Part 2

Introduction 
 This is the second in a series of articles exploring the
 Gleam programming language. The first
article explored some of
the most basic features of Gleam; just enough to say hello. 
 Hello is basically the first thing we learn in any language (whether human or
programming). This article explores looping in Gleam. More specifically,
it explores the fact…

A Tutorial Introduction to Gleam -- Part 1

Introduction 
 Gleam is a newish programming language that I recently
 stumbled upon . It is so little-known
that there aren’t really any tutorials available on it (even on the official
documentation), so I decided to write my own. 
 Gleam transpiles to Javascript and Erlang. I’ll be focusing my attention on the
Erlang side of things, as it is more mature. And…

Some Esoteric Languages

Introduction 
 I was basically flat with an illness (yes, that one) on my back for two weeks
in March. I could do little more than read articles on my tablet, and for
reasons I cannot explain, I began chainsmoking the documentation for as many
little-known languages as I could find. 
 I honestly don’t know why. In the fog of illness, it just seemled a fun thing
to do.…

Rescript, Reason, Typescript, OCAML, Javascript, Help Me Choose!

Introduction 
 I’ve been writing plenty about Rescript this year, although I’ve taken a bit of
a hiatus to focus on developing a couple (Rescript) open source libraries. I
wanted to get back into blogging to answer one of the most confusing questions
in the Rescript community: What is ReasonML and how does it relate to Rescript? 
 However, it has grown into…

Introducing rescript-dexie

As hinted in some of my recent articles on Rescript, I’ve been
working on bindings to the wonderful Dexie interface to
IndexedDB. It’s finally ready to announce to the world (in a fairly beta format)! 
 rescript-dexie depends on a recent
version of Rescript and the rescript-promise 
library. 
 It’s still fairly beta and I haven’t covered all the…

Fast, Bare, Rescript React

Introduction 
 (Note: There is a more recent version
of this article) 
 Most of my Rescript series so far has been about combining Rescript with React
using create-react-app. Now that I understand Rescript better, I’m not so sure
create-react-app is a good fit for it. 
 Mostly because it’s slow. Rescript compiles JSX natively, so we shouldn’t need
slow…

Let's Talk About Functors In Rescript

Introduction 
 For basic syntax, functional programming does not feel that different from
other paradigms. Sure, data and behaviour are separate, so you don’t have
classes or objects or inheritance, but it feels relatively the same. This is
especially true in Rescript, with the pipe-first syntax almost looking like a
method lookup (comparable to the self object in…

Fun With Rescript Polymorphic Variants

Introduction 
 Polymorphic variants in Rescript are strange beasts. They aren’t generally that useful
in pure Rescript programming, but are frequently necessary in binding to Javascript. 
 Polymorphic variants are extremely flexible (too flexible), but one of the most
common uses is to represent a list of constant strings that a JS binding can
accept. For example, the…

Parsing JSON in Rescript

Parsing dynamic content such as JSON in a statically typed language can be rather daunting. This article voices some opinions about schemaless design and migrates some of the messy json parsing code from the standard library to the excellent jzon library.

"Correctly" Unit Testing Express With Rescript And Zora

In a recent article I introduced rescript-zora, a library I wrote for unit testing Rescript code with lightning fast responses. One drawback of zora is that it’s very minimal. In this article, I explore some design principles and go on a bit of a rant about the definition of the word “unit”.

Quickly Testing Rescript With Zora

I wrote Rescript bindings to the zora test framework and wanted to write about how to actually use them.

Syncing RxDB changes to GraphQL Mutations in Rescript

Continuing my explorations of RxDB and Rescript, this article hooks up mutations to allow RxDB to automatically sync its offline-enabled changes to the graphql server.

Syncing RxDB changes from a graphql server in Rescript

I’ve become quite comfortable in Rescript over the course of the past few months. So far in this long-running series, I’ve implemented an RxDB powered offline-enabled application in Rescript. I’ve also written a graphql server using express. In this article, we’ll connect the two so that the RxDB frontend can sync with the graphql database.

Graphql Endpoints to sync with RxDB in Rescript (Part 2)

In the previous article we implemented the sync read endpoints between our graphql server and our RXDB client. In this one, we’ll hook up the mutations.

Graphql Endpoints to sync with RxDB in Rescript (Part 1)

Now that our Rescript client and server have the same data model, we can hook up the graphql endpoints to sync the offline rxdb database with the graphql server.