tags:

views:

39

answers:

1

I am looking to develop a TEX parser, now problem is there is no Context Free Grammar and there can not be one, because its not context free language, I heard that it is some sort of macro language and that builds on its own.

So now I need direction of what kind of grammar this macro language has and how to build anything upon in c#.

I will write the tokenizer and parser, but I need some rules of macro in TEX which are quite hard to find, everywhere else there is documentation about how to use TEX macros.

+2  A: 

TeX as a programming language is perhaps the most complex (non-esoteric) language ever created with a huge amount of "reserved words". You can remap the meaning of every character as it is read by the processor and in general do things you don't normally encounter while parsing a language.

If you really want to create your own TeX parser you will have to build on the original TeX. The source code is not only available, but it is written as a literate program using Knuth's ingenious WEB tool.

Martin Liversage
Thanks, well its quite complicated for me to understand but I will try, I just want a little of TeX to be implemented, like writing little rich text with bold italics and symbols etc. Just like wiki compared to html, i prefer TeX because it can represent maths very well.
Akash Kava