Hacker News new | past | comments | ask | show | jobs | submit login

Does it have a context-free syntax? Because this is basically the only problem with TeX: You cannot parse it.



IIRC there are DSLs that are context free and which compile down to TeX. I just can’t recall at the moment any.. it’s been years. The layout engine inside TeX is second to none. Why throw out the baby with the bath water?


I never encountered a context-free typesetting language that was as powerful as TeX. I assume it would be quite a lot of rather boring work. The main interesting design question would be how to express content and its relationships in some logical way that is distinctive from the algorithmic layouting.


What does context-free syntax mean? And what does “you cannot parse it” mean? Meaning you can’t stream it, you need the whole file first?


Tex is like a programming language, you have to "run" the program to generate output, and that execution is tightly tied to producing output on paper pages. This means it is extremely difficult to produce good looking HTML, or accessible output.


Context free means that the language/program can be described using a "context free grammar": https://en.wikipedia.org/wiki/Context-free_grammar.

Context free grammars are more expressive than regular expressions, but less expressive than full-blown programming languages.

If you've got a spare 100 or so hours and you're interested in learning more, there's a good lecture series on YouTube about this stuff: https://www.youtube.com/watch?v=TOsMcgIK95k&list=PLbtzT1TYeo...




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: