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.
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.
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.
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.
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.
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.
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.
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.
protected by gnat Sep 19 '15 at 19:15
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?