Weblogs


Normy JS IR AST

2021-09-02

Too many abbreviations there, sorry bout that. The IR, or "Intermediate Representation", AST that Preval uses is currently very similar to the regular EStree form. However, the IR kind of evolved out of nowhere without a concrete plan and while that ...


Normy JS p3

2021-08-27

The main thing left to discuss in the first phase are expressions. These are also the most versatile since there are many different ways of achieving the same goal. This pots will describe the expressions in some detail and how to get them to a norma...


Normy JS p2

2021-08-23

Let's start with looking at how we normalize all the statements. In this post I'll cover all the valid statements in normalized code except for the expressions. We'll see what their normalized form is considered to be and how to get there in a few ca...


Normy JS p1

2021-08-21

When normalizing JS there are a few high level phases to consider. The first one would be a purely syntactical normalization. Things like eliminating one statement in favor of another or making sure branching statements always have a block for a body...


Simpler JS

2021-08-18

When I started Preval I wanted to create this pseudo compiler that would take arbitrary JS and spit out the same program, but faster. It would eliminate useless code artifacts that only served the developer and added overhead to the runtime. This pro...


Normalizing while loops

2021-04-05

I'm trying to normalize code, making it as simple and uniform as possible while maintaining original semantics as much as possible. In this post I wanted to share some thoughts around normalizing a while loop. I know you were waiting for this. Strap ...


for scoping

2021-01-22

I stumbled on a new gem yesterday. I'm not sure if I knew this when I was writing Tenko but I certainly forgot about it until Preval was showing unexpected errors for it. The case in point is the special scope in the header of a "for" statement. T...


Normalizing patterns

2020-12-30

One of the more treacherous syntax in modern JS are patterns. On the surface they look benign, easy to work with, and definitely have their usages. But dig deeper and some ugly truths come out. Especially when you mix-and-match arrays with objects, s...


Preval prologue

2020-12-14

I'm going to start a new project. It's probably best described as "something like prepack". The name I picked is kind of a homage to it; "Preval". A combination of "Prepack" and "eval" (surprise). The project is meant to be some kind of code reductio...