[texworks] Count Characters Script

Charlie Sharpsteen chuck at sharpsteen.net
Tue Mar 13 21:52:04 CET 2012

On Tue, Mar 13, 2012 at 12:29 PM, Philip TAYLOR <P.Taylor at rhul.ac.uk> wrote:

> Stefan Löffler wrote:
>  [1] <off-topic>Is TeX Turing-complete?</off-topic>
> I have always [1] believed so.
> Philip Taylor
> --------
> [1] Where "always" is defined as "since 1986".

TeX is worse than Turing-complete---most boring old Turing-complete
programming languages can be completely parsed and deconstructed by a
"dumb" syntax highlighter implemented in a few lines of regular
expressions. TeX is __context sensitive__ and therefore also requires a
__Turing-complete parser__.

This is why it is so difficult to deconstruct an arbitrary bit of TeX
compared to most programming languages, like Python. Python can be parsed
with a simple rule-based program while TeX has to be processed by a program
that could also perform Lambda calculus[1], serve as a BASIC
interpreter[2], or function as a control program for NASA's Mars rovers[3].

The parser for a language like Python cannot stray outside of the rules
defined by the language grammer. The parser for a TeX document can typeset
TeX, or be re-purposed do any other computable task if given the right

See the following TeX StackExchange question for proof and demonstrations:



  [1]: http://ctan.org/pkg/lambda-lists
  [2]: http://ctan.org/pkg/basix
  [3]: http://sdh33b.blogspot.com/2008/07/icfp-contest-2008.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20120313/ccd09d5e/attachment.html>

More information about the texworks mailing list