Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Up until now I don't know the KEY differences between these three. When someone asks me about this, I only tell them that C# is a programming language, HTML and XML are Markup Languages, and JavaScript and VBScript are scripting languages. But what are the key differences that distinguish them from one another?

share|improve this question

5 Answers 5

up vote 20 down vote accepted

Let me attempt to find a dividing line between these three types of language. Of course, there will be numerous exceptions and counterexamples, since this is just my opinion.

  • A markup language is used to control the presentation of data, like "represent these user names as a bullet list or as a table".

  • A scripting language is used to mediate between programs in order to generate data. This is specially true of shell scripting languages like bash, but if you reflect about it, also Python or Perl came from the need to accomplish tasks in UNIX without writing a program in C. The program that you control most of the time in those languages is the interpreter of the language itself, which accomplishes general tasks for you. Other typical programs you interact with are database servers, or web servers.

    Going back to the user list metaphor, in a scripting language you ask the database "give me all user names", then ask the web server "send this user list to this requester".

  • A programming language is used to transform data. It does so by creating CPU instructions that rewrite the input data into the output; hopefully, the desired output. Examples of transforming data is to compute a sum out of a number of addends, or solving a system of differential equations from a set of conditions, or writing and reading from a tree-like structure in a consistent manner given a sequence of possibly simultaneous queries.

    Going back to the user list metaphor, in a programming language you write how to traverse a table of records, extract from each record the "name" field, and return all of them to the requester.

Note that scripting languages are a subset of programming languages i.e. a language may be both "scripting" and "programming": Python is regularly used to "mediate between programs", and also to "transform data". There are other languages like Java which are seldom used to "mediate between programs", not because this is impossible but because they are not designed to make this easy. The key feature of a scripting language is that it can orchestrate other programs, just like a script gives the cue to an actor to start his part.

share|improve this answer
Scripting languages are formally a subclass of programming languages. (I've also seen languages like C and Java being fully interpreted, with a REPL; the barrier is leaky both ways…) – Donal Fellows May 26 '14 at 11:24
@DonalFellows: you are right. I answered with that in mind, but I have not explicitly used the expression "one is a subset of the other". Also, I have not implied that one category is interpreted and the other is not, because I knew that is a weak distinction. – logc May 26 '14 at 11:32
@DonalFellows: I have edited my answer to explicitly mention that one is a subset of the other. – logc May 26 '14 at 12:23
I support this answer for being the only one(so far) that claim that markup languages are languages that describe the structure of data. – Idan Arye May 26 '14 at 12:53
@JörgWMittag: I knew there would be exceptions, that is why I started with "there will be numerous exceptions" :) Otherwise, where in my answer do I imply that a scripting language is not compiled? I tried to concentrate on the purpose of languages precisely in order to avoid that pitfall ... – logc May 26 '14 at 13:47

A markup language is a language which is used to represent structured data. For example, HTML enables to specify that some part of the document is a title or some other part is a list, by comparison to a flat text document.

Markup languages are not considered as programming languages¹.

The difference with programming languages is not always obvious. For example, XSLT is a Turing-complete language², but is based on XML which is a markup language.

Wikipedia itself makes important efforts to avoid qualifying XSLT as either a programming language or a markup language. It only says it's a declarative language, and that it uses “optimization techniques found in functional programming languages and database query languages”.

A scripting language is a programming language which is interpreted, rather than compiled, which means that scripting languages represent a subset of all programming languages.

It is not always obvious whether a programming language is a scripting language, like it's not always obvious whether a language is compiled or interpreted. For example, PHP may be compiled to intermediate bytecode³ and then ranslated into machine code by JIT compiler, while being still considered as scripting language⁴.

See also: Splitting Meta-Hairs by Steven Lott.

¹ “XML is not a programming language”. See XML in 10 points.

² “XSLT is a Turing-complete language” See XSLT on Wikipedia

³ “HHVM compiles Hack and PHP into an intermediate bytecode. This bytecode is then translated into x64 machine code dynamically at runtime by a just-in-time (JIT) compiler.” See HHVM.

Scripting languages in List of programming languages by type on Wikipedia.

share|improve this answer
Languages are never compiled or interpreted. Languages just are. Compilation and interpretation are traits of the compiler or interpreter (duh!) used to implement the language. The terms "compiled language" or "interpreted language" don't even make sense, they belong to different levels of abstraction. If Englisch were a typed language, "compiled language" would be a TypeError! Every language can be implemented by an interpreter, every language can be implemented by a compiler. – Jörg W Mittag May 26 '14 at 10:00
@JörgWMittag "Every language can be implemented by an interpreter, every language can be implemented by a compiler" - 100% true? – spartacus May 26 '14 at 13:36
@spartacus I'm calling that a hesitant "no". I think any language that can be compiled could also be interpreted (just execute the instruction instead of saving it), but I've heard that homoiconicity severely restricts the possibility of compilation – Izkata May 26 '14 at 16:20
@Izkata I wouldn't say homoiconicity itself changes the possibility of compilation, but rather the metaprogramming it allows means much compilation needs to be deferred to runtime, if at all. – Mark Hurd May 28 '14 at 5:27
The "Scripting language" part is purely wrong as "Jörg W Mittag" already pointed out. And on top there is no explanation of "Programing language". – Sid Burn Sep 19 at 16:27

A markup language is used to describe data rather than logic. A typical use of them is to describe document formating, HTML is designed for this for example. But they are sometimes used as general data formats as well, XML is a markup language that is often used to just describe data.

The difference between programming and scripting languages is very fuzzy, both tend to be turing complete in that you can solve any computable problems with them. There are some general 'hints' that you can look for to see if a language is a programming language or not.

  • Scripting Languages are often interpreted rather than compiled, or at least provide the option of being interpreted.
  • Scripting Languages are often built to be fast to work with rather than fast to run.
  • Scripting Languages tend to come with very extensive standard libraries. Many programming languages do as well, but it is more optional for them.

But in the end, if a language is scripting language or programming language is more a matter of convention rather than any strict criteria. Even the hints above are just trends, you will find programming languages that fulfill all the criteria for a scripting language yet are still considered programming languages.

share|improve this answer
Languages are never compiled or interpreted. Languages just are. Compilation and interpretation are traits of the compiler or interpreter (duh!) used to implement the language. The terms "compiled language" or "interpreted language" don't even make sense, they belong to different levels of abstraction. If Englisch were a typed language, "compiled language" would be a TypeError! Every language can be implemented by an interpreter, every language can be implemented by a compiler. It is even possible to automatically generate a compiler from an interpreter and vice versa. – Jörg W Mittag May 26 '14 at 10:01
@JörgWMittag it's true that no language is inherently compiled or interpreted. But there are often conventions on how it is typically executed, which is mainly what I'm referring to here. – Pierre Andersson May 26 '14 at 13:08

To produce any kind of taxonomy, you'd need to first ask yourself some questions:

  • Are objects I'm going to put into whatever relationships defined properly?
  • If so, do they actually exist?
  • Am I limiting myself to only a specific kind of relationships between objects, or is there a set requirement for the system to use only legitimate relations?

Typically, when one hears a question like the one you asked, the expected answer makes several assumptions. For instance, it is natural to assume that since all of these are languages they must form a hierarchy under a more general concept of language, or that they partition the space of all languages, or that they are subsets of each other.

Programming languages

Unfortunately, none of the above seems to be true. Perhaps only the programming languages have a definition most agree on. Programming languages are languages which encode programs. Encoding means that a word in the language can be interpreted as a program (a sequence of actions). Computer programming languages are a subset of these. Examples of non-computer programming languages: a grocery list, interpreted as directions for a buyer in a supermarket, DNA interpreted by transcribing peptides, an analogue musical record serving as a program for a tape recorder.

Computer programming languages are thusly the ones which program computers.

Scripting languages

Aren't well-defined. It is open to interpretation what this term means. Historically, it would seem that programming languages which did not have a compiler to produce machine code had been called this way. By today's standards this would put every popular programming language sans Assemblers into this category. Even the so-called low-level languages like C require a runtime with pre-existing procedures, thus the binaries obtained by compiling a C program aren't entirely machine code, but also call to the runtime every now and then.

Markup languages

Aren't well-defined. Whenever the term is used, the intention seems to be to describe a programming language with very limited lexicon, primarily used to generate visual or audio image. It may be difficult to see XML as programming something, but if you look at Man or TexInfo markup, you'll see that the "special" characters are actually instructions of the interpreter.

It is also possible to give a "programming" interpretation for XML language, something that could go like this:

< := put interpreter in the reading node mode
! := if reading node, start CData/Comment mode
     else if not in read text mode, signal error
-- := if in start CData/Comment mode, start comment
      else if in comment, put in end comment mode
      else if in end comment mode, signal error

Bottom line: this division as of today, doesn't seem very meaningful, it can only give you some intuition as to what kind of language you are faced with, but it will not provide you with rigorous definition.

share|improve this answer

All three concepts overlap somewhat, so you can get endless arguments whether XSLT is a programming language or whether Python is a scripting language or not.

A markup language is a language which represent structured data in a textual format, HTML is the most well-known, but there are numerous formats for various purposes, like SVG for graphics, WSDL for describing web service interfaces, resx for resouce files in .net and so on. A rule of thumb is that a markup language does not describe a process or algorithm (like a programming language does) but is pure data. But it is also a fundamental CS insight that there is no fundamental difference between code and data. Some markup languages like XSLT has loops and conditionals like a "real" programming language, and some programming languages like Prolog are almost pure data with no process specified in the code. And Lisp blurs the line so much it treats its own code as a structured data format.

As for the distinction between programming language and scripting language, this is a historical distinction which is almost obsolete today. In the olden days we had compiled stand-alone programs written in say C, and then we had scripting languages like say shell scripts or Word Basic, which were interpreted and designed to manipulate other programs and tool. Today the line is quite blurred with a lot of middle ground, since we have various levels of compilation and interpretation (bytecode compilation, JIT-compilation etc.), and various language-independent API's. So the distinction is not that useful.

share|improve this answer

protected by gnat Sep 19 at 19:15

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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