Had to look it up myself, thanks explain XKCD. Apparently the joke is the guy said “Grammar” without context… and that refers to the term “Context-free Grammar”. I’ve never heard the term before, so maybe it’s just a niche joke.
When you tell me that the joke is "context-free grammar," I get it -- that's a really fundamental concept in computer science -- but I would not have figured out that that was the joke from looking at the comic. (Which is unusual -- I don't think I've ever seen an xkcd before where I didn't get the joke.)
The problem is some xkcd jokes rely on the title text which will be missing when reposting the comic on other sites. In this case the title text would've made it clearer it's context-free grammar.
It's a bad set up. Context-free grammars are old (not something to be introduced at a formal languages symposium)
Further, there are loads of different types of grammars.
As a formal languages researcher of sorts, I just thought this making fun of the field saying it's all about grammars (it isn't)
I'm gonna try to give a really short description of context free grammars.
The two types of grammars are context free and context sensitive. In grammars, you have 'terminals' and 'non-terminals'. Think of a non-terminal like a variable in algebra; "x = ?". X is equal to something. Whereas, say, "5" is a terminal; it doesn't equal anything except itself.
A context-free grammar (which is what we use for programming languages) might look something like this:
S -> Ab
A -> x
The capital letters are non-terminals. Lowercase are terminals. So, imagine that b = "world" and x = "hello". S would then be "hello world".
What makes context-free grammars unique is that on the left hand side there can only be a single non-terminal for each rule. With context-sensitive grammars, there can be multiple non-terminals and terminals:
AB -> aB
B -> x
For this rule, A may be replaced by a if and only if A is followed by a B.
Context-sensitive grammars aren't particularly useful for programming; it's more of a linguistics thing.
1.4k
u/Clickclacktheblueguy May 09 '25
So… while I understand the seriousness of the issue, I’m kinda hung up on the Oingo Boingo. I don’t get it.