Socratic AI: how I learned formal grammars (and built a compiler) without losing control of what I was building
Table of Contents The context The problem The method How it works in practice When the method isn't needed The limits of the method One way among many Links 1. The context About a month ago I start...

Source: DEV Community
Table of Contents The context The problem The method How it works in practice When the method isn't needed The limits of the method One way among many Links 1. The context About a month ago I started building Clutter: a compiler for a custom markup language that outputs Vue SFCs. The idea was to enforce design system compliance at compile time, if a value isn't in the token dictionary, the build fails. It stayed a POC, proved its point, and opened larger questions that are evolving into a different project. I wrote it in Rust, which I'm learning. I had no background in formal grammars beyond a university course I took over twenty years ago and mostly forgot. The goal was to have a working compiler I fully understood, every design choice and the reasoning behind it. To know how it worked well enough to make deliberate decisions about it. That's a different problem from "I need a lexer and a parser." It's closer to: I need to know what I'm choosing, and why, before I write a single line