Now: Researching DSL stuff, ended up on context-free grammar

Posted December 7, 2019 in Now, Research


One issue with Larva is that we have to write a bunch of JavaScript to update the data and classes in objects, and the data part of that has to essentially be replicated in the PHP controllers. It’s annoying and if your editor is not set up correctly, very time-consuming.

My manager/friend/boss at PMC, Aaron Jorbin, remarked that JavaScript is perhaps not the right language to accomplish what we are trying to do, and he suggested I look into using or even creating a DSL, or domain-specific language, instead. Sign me up! Learning more about programming language design in on my 2020 Lara Learning Roadmap™️. It’s a good sign when work things sync up with Lara things.

Here are few things I came across in this stream of Saturday free-form research:

  • BangBang Con 2019 talk: Writing an Interpreter in SQL for Fun and No Profit! by Michael Malis
  • I found the book DSL Engineering at my co-working space, Code & Supply, and have started reading it during lunch (three pages in, so far). Here are some slides of the author’s on DSL design and DSL implementation which I might look at instead of reading the book as it is quite long and intimidating…
  • Now jumping to more generic language topics….
  • Backus-Naur form (BNF) – a common notation technique for context-free grammars.
    • I remember seeing BNF notation in a section about regex from my favorite lunch read, Zero Bugs and Program Faster by Kate Thompson.
    • One of the most effective techniques for learning a new concept: see it one place, allow some time to go by, see it in another place. Rinse and repeat…until…(opportunity for a metaphor indicating recursion / base-case. I haven’t internalized an understanding of recursion well enough to fully express that, yet.)
  • What is a context-free grammar? In the words of Matt Might, a context-free grammar is the language of languages. In my own words (after reading his and others’ articles): it is notation used to express the rules for a formal language, that is a language with a very specific strcuture and syntax that cannot deviate from that structure and syntax. This is opposed to natural language which is the language we speak, and one that changes over time and does not always conform to defined semantics and syntax in the way a formal language does.
  • This video from the Coding Train about context-free grammar cleared a lot up for me – I need to remember to check there sooner when exploring programming topics.

It’s time to get off the computer now, and get outside on this sunny Saturday before it is no longer sunny. I thought I would be able to “quickly write a blog post with research links”, but alas, that is not possible.

Next up in this stream of research (unless this post is the beginning and end which is possible since I am easily distracted) will be to look into the resources demoed in the Coding Train video and then, of course, map all of this back to the language I know best (besides English): CSS. I’ll probably start with Grammar of CSS 2.2.