libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
Introduction

Hi, I'm Ethan. I got interested in designing programming langauges since reading Bob Nystorm's Crafting Interpreters many years ago. This project is a complete overhaul/rewrite of my compiler infrastructure for my language pulsar. Feel free to explore!

I am building this compiler from scratch, that is,

  • using only POSIX and two libraries of my own making (mtrack and libtermcolor)
  • without parser/lexer generators
  • without LLVM
  • in C

In other words, my aim is to gain as much experience with the workings of every component in a compiler, NOT to create a useful language for others.

This rewrite is still very much a work in progress. Much of the code has yet to be written.

Overview

This project is not the complete compiler. Rather, it is merely the frontend-to-optimized-IR pipeline. libpulsar can load various backends (called "modules") that take in this optimized IR and produce output of varying formats. Obviously, the first thing I will do is write a VM to interpret the IR, but the main goal is to produce object files natively. (This is nontrivial on macOS; see my posts on how I managed to figure this out through reverse engineering.)

Project Components

  • The Frontend contains the lexer, parser, and static analyzer
  • The Backend handles IR generation optimization
  • The Data Structures include hash maps and [wip]
  • The Utilities manage memory and program state
  • The Error system enables reporting and displaying errors
  • The Testing Infrastructure ensures that the compiler is working properly

Website Credits

This website was built using Doxygen. The theme was adapted from Joe Wong's doxygen_theme_flat_design. It is licensed under the MIT license. My modified source is available here.