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?
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.
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. |
|||||||||||||||||||||
|
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.
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. |
|||||||||
|
To produce any kind of taxonomy, you'd need to first ask yourself some questions:
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 languagesUnfortunately, 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 languagesAren'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 languagesAren'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:
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. |
|||
|
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?