Some tricks from the Scrapscript compiler (bernsteinbear.com)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 11 Jul 2024 21:05
https://programming.dev/post/16725323

Scrapscript is a small, pure, functional, content-addressable, network-first programming language.

fact 5
. fact =
  | 0 -> 1
  | n -> n * fact (n - 1)

My previous post talked about the compiler that Chris and I built. This post is about some optimization tricks that we’ve added since.

Pretty much all of these tricks are standard operating procedure for language runtimes (OCaml, MicroPython, Objective-C, Skybison, etc). We didn’t invent them.

They’re also somewhat limited in scope; the goal was to be able to add as much as possible to the baseline compiler without making it or the runtime notably more complicated. A fully-featured optimizing compiler is coming soon™ but not ready yet.

#programming_languages

threaded - newest