Sibyl Lang Devlog #1 - Current State of Affairs

Published: Last updated:
  • #post
  • #devlog
  • #sibyl


Sibyl is a project to create a ML-like functional programming language to learn about and satisfy my curiosity itch for compilers and code generation. It's implemented in OCaml, and the majority of it was done earlier this year. Since then I've been on a long hiatus from working on it due to real-life factors.


// current syntax
fn fib(n: int): int {
let a: int = if (n < 2) then n
else fib(n - 1) + fib(n - 2)
return a
let a: int = fib(20)
print a

Where It's At

Currently the codebase is a little all over the place. Roughly I have the following implemented:

At first I had a platform-agnostic code generator interface that let me implement different backends (JavaScript, x64, etc) using an OCaml functor, however over time I found it restrictive along with the fact that since I don't know a lot about compiler design it's hard to design a generic interface upfront.

What's Next

In the next devlog I'm going to document the process of cleaning up some of the loose ends and stripping out unused code.

I'd also like to refactor the current backend so that it uses the generic code generator interface again. In order to do this I need to refactor some of the current code, and restructure the code generator module type (OCaml lingo). This will be easiest by stripping out as much functionality as possible and simplifying as much as possible. I'll try and provide code examples of how I do this in the next devlog.


In terms of the vague order of functionality I'd like to implement I have the current WIP list:

  • Type inference
  • Loops
  • String literals
  • Static arrays
  • Lists
  • String type
  • Pattern matching
  • File IO
  • Algebraic Data types
  • Dynamic arrays / slices
  • Tail recursion
  • Tuples
  • Garbage Collector
  • Module system
  • Structs
  • Stdlib: JSON
  • Stdlib: HTTP

Thank you for reading,