Glyph

- 3 mins read

glyph glyph glyph


What even is glyph? A glyph is, the smallest meaningful symbol in a system.

And me creating a custom database is very much inspired by literally wanting to turn glyphs (characters) into database.

The inspiration came from a need to create something with no boilerplate, no clear idea of where I was going to take the project, and no AI, for once.

I had missed raw coding for a while, the type where I fight the compiler to validate me, so I just took this passion project on the side and honestly, I would say it was the most fun project I’ve worked on.

The idea started with thinking that I would be making a parser–tokenizer typa compiler and adding some magic behind the functions to give it a brain.

Definitely, there was more to it, so it’s still ongoing. In first week, I spent most of my time creating a simple compiler that parses and tokenizes SQL queries, not really doing anything meaningful yet, intentionally, but adding test cases for compilation edge cases (since I wanted test driven development a proper try) was all what I really did.

Then came the next few weeks where the real magic began. It involved making the database in-memory, and as I had read in this one book, SQLite Database System Design and Implementation by Sibsankar Haldar, we shall do it via paging!

I was blown away, not gonna lie.

I had studied heavy Operating Systems concepts a few months prior to this project, but I had never really implemented all that theory until now. This was my time, and I went ahead and implemented it. For the current demo, it was a simple row-based database.

But the real charm, my love, B-TREES.

Another concept the teacher taught in class and said it was so complicated that there was no point in learning the code for it until we really needed it in the future. Lol.

See, I did know B-trees. Just like OS, I had learned B-trees a few months prior. And when the B-tree implementation phase came, my 15 days went by in a daze, and I was walking around feeling like damn, B-Trees are cool as hell.

Especially after understanding why B-Trees and paging flow so naturally together. Once the paging and B-tree insertion were done, it was time to add real power to SQL queries.

I started simple, and by the time I thought I was still doing “simple,” I had already achieved implementing most core logic of DDL, DQL, and DML commands.

Work is still in progress, a lot of hard-coding needs to be replaced with real stuff, some commands need to be added, and optimizations are ongoing.

And hence, I present my most soul-fulfilling-mentally-ravishing-and-rewarding project!

FUN as hell.


Github: https://github.com/euphoricair7/glyph