[Top][All Lists]

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

Re: Any basic cpp capability m4 cannot do?

From: Daniel Goldman
Subject: Re: Any basic cpp capability m4 cannot do?
Date: Mon, 12 May 2014 21:04:50 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Hi Eric,

Upon further reflection, I would have to agree you right, that m4 seems to be Turing Complete. Yes, m4 cannot be used by itself to write Dungeons and Dragons or the UNIX OS. But all that matters is that it can emulate the Turing Machine.

As you mention, being Turing Complete does not indicate usefulness. Of course the reason for my post was of a more practical nature. So I might reword my question to: Can anyone suggest some non-trivial pre-processing capability cpp can readily do that m4 cannot readily do? The word "readily" indicates the focus on practicality.

Unless anyone has more suggestions, it seems that m4 can readily do any pre-processing task cpp can readily do, with the possible exception of "\"strings\" within strings" variations, which cpp does automatically. On the reverse, there are many basic things m4 can readily do that cpp cannot readily do (that's why I started the conversion!).


On 5/10/2014 12:52 PM, Eric Blake wrote:
On 05/10/2014 01:39 PM, Daniel Goldman wrote:

Not to go too much on a tangent, I feel uncomfortable labeling m4
"Turing Complete". I am no expert, but based on my best understanding,
"Turing Complete" refers to programming languages, and does not apply to

M4 is a pre-processor that also happens to be a programming language.
It may not be the most efficient language, and you are correct that no
one would use it to write an OS, but that does not diminish the fact
that it is still a programming language.

But I think maybe it's going to far to say m4 is "Turing Complete" and
"can do anything". Maybe it's enough that it's very useful, and can do
needed pre-processing tasks.

Just because something is Turing Complete doesn't mean it is useful in
an efficient time-frame for all tasks, merely that all tasks that can be
done in finite resources can be done in that language.  You are correct
that different languages have different strengths, and that m4's
strength is in pre-processing tasks, while other tasks easy in many
languages are rather convoluted in m4.

reply via email to

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