Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

My programming friends are always telling me that HTML is a markup language and C++ is a programming language. When I ask them what's the difference, they never give me a reasonable answer.

What could make one call C++ a programming language, and HTML not?

share|improve this question
Do you mean other than being Turing complete? –  Manoj R Dec 28 '12 at 8:01
@ManojR Not all Turing complete languages are considered programming languages, for example XSLT. –  Yannis Rizos Dec 28 '12 at 8:04
Re closing, see the Q/A in meta at meta.programmers.stackexchange.com/q/5397/70298 –  miraculixx Dec 29 '12 at 8:19
Great edit @gnat, thanks. Question re-opened, obsolete comments removed. –  Yannis Rizos Dec 29 '12 at 10:38
@YannisRizos I just copied clarification given by OP in comments. Wonder why so many users put important stuff about their posts in comments, instead of editing; myself I almost always edit my posts in cases like that –  gnat Dec 29 '12 at 10:41

4 Answers 4

up vote 44 down vote accepted

A programming language is a notation designed to pass instructions to a machine. By that definition both C++ and HTML are programming languages, as was the notation Joseph Marie Jacquard used in 1801 to program his looms.

However with the proliferation of languages that are used to structure and/or describe data, the definition of a programming language shifted to include only languages that are capable of expressing algorithms. This is the more common definition today and it excludes languages like HTML or XML.

At the heart of the current definition is the concept of Turing completeness. Most programming languages are Turing complete, and Turing completeness is often quoted as the one critical trait that separates a programming language from any other computer language. This is good enough as a general rule of thumb, but not entirely accurate:

  1. Some non Turing complete languages are considered programming languages, for example Charity.
  2. Some languages that are not generally considered programming languages are Turing complete, for example XSLT.
  3. Turing completeness alone doesn't say much about a language's usefulness.

Depending on context, you can pick any definition you want.


Let it further be known, an implementation of a language does not confer characteristics onto the language itself, for example: A language's spec may define a turing complete language, someone could implement it haphazardly leaving off turing completeness. This implementation being non-turing complete does not however mean the language itself is not turing complete (rather it likely means that implementation is non-conformant). The details of a language and the details of a particular implementation of a language are to be recognized as separate things, this is why it's inaccurate to call a language interpreted or compiled etc.

share|improve this answer
Could you elaborate on the "XSLT not considered a programming language". I never have seen this and IMO I would even question somebody's knowledge or competence with PLs when uttering this. I can't even think of any reason why XSLT shouldn't be regarded a PL (XSLT might be a mild case of turing tarpit but that's another issue). –  bhaak Dec 29 '12 at 13:15
@bhaak I'm not saying it shouldn't be considered a programming language. Data transformation languages are not generally thought of as programming languages, which says absolutely nothing at all for if they are, or aren't programming languages. I've seen business logic in XSLT and I personally consider it a programming language. But I probably wouldn't, if I haven't first seen it at work. In any case, who cares? –  Yannis Rizos Dec 29 '12 at 13:39
You could add a sentence or two on what it means to be turing complete. –  phant0m Dec 29 '12 at 19:55
@phant0m What makes a language Turing-complete? –  Yannis Rizos Dec 29 '12 at 20:20
@think123 I don't think I can give a simpler definition than the one in Wikipedia, and I've already linked to the relevant article in the answer. –  Yannis Rizos Dec 29 '12 at 23:41

The phrase "I know it when I see it" is a colloquial expression by which a speaker attempts to categorize an observable fact or event, although the category is subjective or lacks clearly defined parameters. The phrase was famously used by United States Supreme Court Justice Potter Stewart to describe his threshold test for obscenity in Jacobellis v. Ohio (1964).

-- "I know it when I see it" Wikipedia article

Like obscenity, I think we all know a programming language when we see one. Clearly the OP does, since you've already judged C++ to be a programming language, and HTML not to be one.

So what exactly is the goal of pursuing a formal definition? Yannis has already given a great rundown of why the most popular definition, Turing completeness, is flawed: it leads to categorization which defy the "I know it when I see it" test.

I put it to you that any definition you can come up with will lead to some languages which we all feel are not "programming" languages will be categorized as being so; or to some languages which we all feel are "programming" languages will be categorized as not being so.

Why not just go with your gut? I use a simple heuristic: a programming language is a language whose primary purpose, in my opinion and according to my observations, is to write programs. Not to mark up content. Not to transform XML. To write general purpose programs. I'd rather just know it when I see it than try to nail down a formal definition, and I don't see any genuine value that can come from attempting such a definition.

share|improve this answer
But now you are limiting "programming languages" to "general purpose programming languages". The latter is what people usually means when they say "programming language", but pursuing exactly what the defining characteristics are of a "programming language" also has its point in understanding what programming languages are, how they work, and what their limitations are. For example, any skilled programmer has to recognize the halting problem when they encounter it, which would be difficult without studying the theoretical boundaries of programming languages. –  JesperE Dec 28 '12 at 21:39
@JesperE: I'm happy to limit my "I know it when I see it" judgement to programming languages that are at least fairly general in purpose. Also I disagree that "any skilled programmer" needs any knowledge of the halting problem - I know that my knowledge of it from my formal computer science education has never been of any relevance to me in nearly two decades of professional development. –  Carson63000 Dec 29 '12 at 5:45
If you haven't had to bring it up, that's probably good. That doesn't mean that it is not important to know. You don't judge the quality of your seatbelt by how often it came to actual use, do you? –  JesperE Dec 29 '12 at 10:16
By your heuristic, is elisp a programming language? –  Brian Apr 26 '13 at 18:15
@Brian: interesting one! I guess I've always simply thought of elisp as an implementation of Lisp, which clearly is a programming language, even though this particular implementation is much more specific in its scope of purpose. –  Carson63000 Apr 27 '13 at 3:14

Markup languages mainly deal with how the information is displayed and they generally lack in the programming infrastructure of variables, math, comparison, decision making (if ... then), loops (for, while), etc.

HTML by itself is static; that is, much like a word-processor, it is meant to present the information as it is. Only with the addition of some sort of programming languages (usually scripting languages like JavaScript, PHP, etc) can the HTML web pages can have a "changing" content. The scripting languages provide the "programming" possibilities with variables, math, comparisons, decision making, loops, etc.

share|improve this answer

HTML is a declarative language. It doesn't do much on its own, it just describes a document and its content (using tags that have a semantic meaning).

C++ on the other hand does something. It does define functions and classes, but it also describes how these functions should work together, how their inputs and outputs are tied together in a meaningful way and how the application should run as a whole.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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