1

(Previously)

Is there a TeX grammar that parses simple constructs like document, enumerate, section, subsection, etc.? I'm not interested in parsing complicated constructs requiring a more complex computational model.

2

Short answer, no.

longer answer there are of course grammars for various subsets. One possible starting point would be the flex source of the tex grammar used by the tth system. It's not that accurate for modern real world latex files, but it will parse a core subset well enough (or at least it used to, I haven't tried it for a long time)/

http://hutchinson.belmont.ma.us/tth/

  • Thanks, I'm working on it now and I'll post it as an answer when I'm done. – Neil G Feb 11 '15 at 19:56
  • Where is the flex file? I looked in the source for tth and ttm but only found the flex output as a C file. Thanks! – cxw Jun 23 '15 at 13:42
  • @cxw I haven't looked for 10 years or so, I thought that I remembered it used to be public perhaps it's been withdrawn, you'd need to ask the author. – David Carlisle Jun 23 '15 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.