Get the latest tech news

Is there a BNF grammar of the TeX language? (2010)


I'm looking for a BNF grammar of the TeX language, does it exist? EDIT For those of us who are not computer scientists, a BNF grammar is one kind of formal description of a CFG: Backus Naur Form....

If delimited macros weren't bad enough, things get even worse when you realize that the reason that the characters\,{,},$, and so on have the behavior they do is simply because TeX specifies that they have particular "category codes". Edit 1: In addition to minor bugfixes/cleanup and breaking the answer into sections with headings, I expanded the rationale for TeX being unparsable by anything short of a Turing machine to hopefully make it slightly more clear. To understand the relationship between the lambda calculus and Turing machines one needs to refer to the Entscheidungsproblem which is one of the famous 23 problems proposed by David Hilbert.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of BNF

BNF

Photo of TeX language

TeX language

Photo of BNF grammar

BNF grammar