[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any basic cpp capability m4 cannot do?

From: Doug McIlroy
Subject: Re: Any basic cpp capability m4 cannot do?
Date: Tue, 13 May 2014 07:29:04 -0400
User-agent: Heirloom mailx 12.5 7/5/10

>  m4 seems to be Turing complete

It's pretty hard for any language with memory (the macro table) and
conditionals not to be.

I made the following comment before, but mistakenly omitted the
context, so it read pretty mysteriously. Turing complete does not
mean "it can do anything", where that is taken to mean that it
can give the same literal output as any other processor. That's
a trivial remark when the two processors work on different
character sets. A universal machine can, from a suitable encoding
of another machine's input compute an encoding of the subject
machine's output.

The question of whether m4 can produce the same output as cpp
can't be answered by appeal to universality. Obviously it can't
take the same input, because "define" looks different in the
two languages. Whether there's a general way to encode cpp input
so that m4 produces output that is identical to cpp's is
very much an open question.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]