3 ms·
You're absolutely right that the kind of APL in my parser looks alien. And you're right that there would be a 100X blowup in code size for an equivalent C imple
by xelxebar 3y ago
You're absolutely right that the kind of APL in my parser looks alien. And you're right that there would be a 100X blowup in code size for an equivalent C implementation.
Part of the issue is that you're seeing the entire application architecture on a single page. Zero libraries, to boot. I'd expect a similar feeling from looking at a detailed architectural diagram for some business application in a domain that you're only partially familiar with.
The code is written specifically for the domain expert, trading off ease of onboarding everywhere it would incur a cognitive cost. The reason I do this is specifically to eliminate any incidental complexity and force myself to only cognate directly about the problem domain.
It's a funny feeling. Almost every character in the code reifies a concrete feature of the parsing architecture. Said another way, I can't go in and change anything _without_ having to think about deep and relevant questions in YAML itself or the way I'm choosing to decompose the parsing problem.
One could argue that something similar is true about spaghetti code, since changing one piece of code affects every other, but I've really worked hard to orthogonalize out and compose salient features of YAML. Implicitly, every line of code is a parser pass that defines a type transformation on the AST. Each pass introduces specific invariants that later passes can rely on to express higher-level ideas.
Anyway, I set out on the parser project specifically to verify whether such a development experience is possible. Aaron Hsu has videos on youtube expounding similar ideas, but it's hard to believe unless you directly feel it yourself.
> What's a good place to start for languages like this?
Come over to the APL Orchard (https://apl.chat https://apl.chat). It's pretty active, and the main Dyalog member there, Adám, is both incredibly knowledgeable as well as very available for helping interested beginners.
- 7thaccount 3y agoI was about to ask if Aaron had inspired you considering how similar your comments are as well as the type of problem your solving. Neat to see others doing the same!