Definition
I would say that something is programming language (PL) if:
- 1: there is a machine that can do some actions (computations) based on the text written in the language (program)
- 2: or this language can be mechanically translated (compiled) to a programming language
Now let's see if we can tell based on this rule if something a PL or not.
- Machine code? Yes, it can be interpreted by CPU
- Assembly? Yes, it can be compiled to machine code.
- C? Yes, it can be compiled to an assembly.
- JavaScript? Yes, it can be interpreted by nodejs.
- Postscript? Yes, it can be interpreted by Ghostcript.
- HTML? Yes, it can be interpreted by a browser.
Wait a second ... is HTML a programming language?
Yes according to my definition of PL (if you disagree provide your definition). There is a grammar, which specifies how to parse it. There is an interpreter - in response to instruction in the program it renders different things on the screen.
But is it Turing complete?
Irrelevant question.
- Brainfuck is Turing complete, but do you want to program with it?
- Agda and Coq are not Turing complete, but nobody seems to doubt that those are programming languages
Turing Complete | Not Turing complete | |
---|---|---|
Practical | JavaScript, Haskell, Go | HTML, CSS, Regex |
Not practical | "Turing tar-pit" |
- Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.
-- Alan Perlis
Turing tarpit examples: Brainfuck, C++ templates.
Related: "Pacman complete" (a term coined by Edwin Brady?) - how is it easy to implement Pacman game in the programming language (as an alternative to Turing completeness).
General-purpose vs special-purpose
Or maybe you want to ask: is it a general-purpose PL? No, it's not - it has a special purpose to denote markup for hypertext. Postscript is Turing complete, but it is used for the same purpose as HTML - to denote markup.
Turing Complete | Not Turing complete | |
---|---|---|
general-purpose | JavaScript, Haskell, Go | |
special-purpose | Postscript, Bash, Make | HTML, CSS, Regex |
Another name for special-purpose PL is a domain-specific language (DSL).
Declarative vs imperative
Declarative programming is when you write your code in such a way that it describes what you want to do, and not how you want to do it.
From my point of view, this is a very "sketchy" definition. For example, in CSS (before flexbox) to center div
you would do something like this:
.container {
...
position: relative;
}
.child {
width: 50px;
/* Center vertically */
position: absolute;
top: 50%;
margin-top: -25px; /* half this element's height */
}
Is it fair to say that I'm expressing "what" instead of "how"? Effectively I say move 50% from top and half of height back.
Turing Complete | Not Turing complete | |
---|---|---|
Declarative | Haskell | HTML, CSS, Regex |
Imperative | JS, Go |
Let's continue with the quiz
-
XML? In general case no, in special cases yes.
- XHTML? Yes
- Apache ant? Yes
- SVG? Yes
XML itself has no meaning, it describes the structure. But as soon as you declare an application that can interpret XML you "define a meaning" for it.
PS
If you don't know how compilers work, then you don't know how computers work.
-- Steve Yegge
I would change it a bit: "if you don't know how compilers and interpreters...".
Top comments (44)
I don't really care for the "PL or not" debates, but an interesting question popped into my head—would you say Markdown is a programming language? Because it satisfies condition 2 (since HTML is also a programming language, in this view).🤔
Yes, it is a PL, by a given definition.
But markdown is almost a plain text. Is the plain text a PL? No. And here is my reasoning for it - in the case of plain text machine doesn't interpret it, it simply passes it through.
Imagine teletype connected to the machine, you input some text and in response machine do some actions, for example, if it sees markdown tag for the header (
# h1
) it will print text (on paper) in a bigger font.Now imagine a machine that does not support tags, and simply passes through text as-is. You can as well remove the machine and shortcut wire from teletype to printer. When you can "shortcut wires" it means there is no need for the machine. If there is no machine, then it's not a PL.
I don't think that your definition of a programming language is actually what is the agreed upon definition in the industry.
A PL is a series of instructions, used to implement algorithms, perform data processing, and is something that is executed. HTML does none of these things, it's merely a language used to assign some semantic meaning to data, in exactly the same way that markdown does. HTML and Markdown are parsed by something else in order to produce output, by themselves they cannot do anything.
Something like XML on the other hand absolutely would be a programming language. It can perform processing (via XSL which is an XML subset) with loops, jump points, etc. The only way HTML can perform the duties of a programming language is with the help of an additional language, such as Javascript (or possibly CSS, but it's pretty contentious and depends heavily on the parser involved)
I doubt anybody ever made industry wide survey to agree on one definition. So my definition has the same footing as yours 🤷♀️
Your definition: A PL is a series of instructions, used to implement algorithms, perform data processing, and is something that is executed.
There are industry definitions for a programming language, that's not my definition, it's me trying to explain it.
HTML isn't a series of instructions, it's more hints. An H1 tag doesn't make font bigger, it just instructs the parser that the contents within it are a level 1 heading, then it's up to the display engine attached to that parser to do what it likes with that information. That may be to make the font larger (which all depends on CSS anyway, without that it's not going to change a font size) or to speak it out prefixed with "Heading level 1" in the case of a screen reader.
An algorithm also has a fairly well described definition: "a process or set of rules to be followed in calculations or other problem-solving operations". HTML cannot describe a problem-solving process as it doesn't really contain anything close to branching concepts. In order to do that, at the very least you need some kind of loop, state machine, or jumping logic, none of which HTML has.
HTML isn't really executed so much as parsed. Now, the line here is blurry, as there are programming languages out there which have a parsing stage. This process converts it into something else which is then executed. Now, possibly, you could use XSL to transform a structured XHTML document (which isn't quite HTML, it's the nearest you can create using XML) into something which then gets executed, but then you're still relying on an something else to do the work, it's not really HTML itself anymore.
Please provide the source
@ashleyjsheridan totally agree! per its official definition it is a markup language: tools.ietf.org/html/rfc1866
Its parsed and there are currently no way to do any algorithms in HTML
Wow, you guys have argued quite a bit😅. Some interesting points here.
I think I like how @ashleyjsheridan and @crimsonmed have put it. They got me thinking about something: what's markup?
To "mark a document up" means to annotate it, typically to add some meaning. So you can't write markup by itself. There must be a text that the markup describes; otherwise it's useless. Similarly, a document with only HTML/Markdown tags (and no other text within the tags) is pointless (leaving CSS and JS out of the equation for now). It likely won't show anything when the browser renders it.
However, a file containing only PHP syntax is totally valid and will do something when executed by the PHP interpreter. I think this is an important difference. 🤔
Removing text from HTML is like removing IO operations from PHP. Example:
vs
Now let's "remove text"
vs
In both cases it will do calculation (browser will build DOM, JS will iterate over
i
) and in both case we will "see" no outputA
for
loop isn't comparable to a pre-build<ul>
list of items. A fair comparison would be to compare your<ul>
list with the following:That's it, just numbers. There's no loop, no iteration, it's already built by you. There is no program. If HTML ever got that capability, then it could be part way to be considered a programming language, but for now it's a markup language only.
So you say that
Is not a program? Can you give definition for a program so I can differentiate what is program and what is not?
Already gave it a lot of times but you can't read. As said in all the definitions apart the one you made up a programming languages differs from a markup language at is can compute. Typically wrttting the first 10k prime numbers or 10k fibonacci sequence numbers. Something that you would have to calculate yourself and then write all the answers in a ul for html as it won't be able to calculate.
The point is simply algorithms. Html can't create and solve algorithms that compute various operations.
You can't even do 2 squared in html.
You gonna ask where the definition comes from and once again I gonna tell you I posted over 10 links as well as rfc and others that you admitted to not being bothered to read. So @ashley Sheridan it's better to leave this guy to his ignorance as he not willing to learn.
This is (technically) a program (albeit incredibly basic) written in a programming language. Doing this same thing in HTML wouldn't be a program as HTML isn't a programming language.
I'm glad we figured out that this is a program.
So what is your definition of a programming language? It should contain iteration? SQL (query part, I'm not talking about stored procedures) contains iterations. Is it a programming language?
You can't compare HTML and SQL. One per its official definition is a markup languages and the other one by its official definition is a query language.
If you are going to make comparisons don't compare dogs and apples. Compare green and red apples.
Go and compare markdown and HTML.
This is the exact same issue where you went and compared sea lion and lion without even looking at their offiacally defined name which differ completely.
@ashley Sheridan you'll never get anyway om this thread I think he is just reaching for the post with most comment badge.
SQL is absolutely a programming language. It contains loops, branching logic, can define functions and procedures. XML is also a programming language, as it too has all of these things. XHTML wouldn't be, because it's an XML subset that omits those features, although technically you can use XSL to convert an XHTML page (just not a standard HTML one) into something else.
Right. Latest versions indeed contain that. But I asked would you consider initial SQL which had SELECT, INSERT, UPDATE and DELETE to be a programming language? (Without stored procedures and functions)
For example, sqlite doesn't have stored procedures (there is
WITH RECURSIVE
but again this is later addition).You're deliberately omitting parts of my answer to attempt to make an argument for you. I specifically mentioned that SQL had loops and branching logic. That's been part of it for many, many years (I don't even recall a time when it wasn't).
Can you point to any part of HTML that contains:
These are all parts (not the only parts, however) that constitute a programming language as determined the definition of the term. I do understand that you're trying to understand the term yourself, and maybe want to make the argument that HTML should be classed as a PL, but that's based on a slightly flawed concept of what a programming language is. This doesn't lessen HTML in any way and doesn't make anyone who knows it and uses it less of a developer.
I don't omit anything. I'm asking question. I'm trying to pinpoint your definition of a language. I'm trying to understand if bounded iterations are enough or not (that is why question about SQL).
Yes. But my initial question was about SQL which doesn't contain stored procedures. That is why I asked again. For example SQLite doesn't contain stored procedures.
So you say that programming language should contain:
I will take it as your definition (it is really hard to get this answer from you - you're so focused on HTML...)
So functions are optional? (You didn't mentioned them)
What the difference between Variables and State management?
Stored procedures are not the same thing as branching logic. Does SQLLite contain branching logic? Absolutely. Can HTML? Absolutely not.
Isn't this entire thread specifically about HTML? Given that, is there any wonder why I try to keep the thread on topic (your topic), which is HTML? Also, I have mentioned before, it's not my defintion, it's the definition of a programming language. You seem to have a version of the definition which is yours but it doesn't match the industry definition.
Functions are option, yes. Look at BASIC, which has no functions, but is 100% a programming language.
State management isn't the exact same thing as having availability to variables. For example, direct memory access could be considered a form of very low level state management, although without the use of variables this would become incredibly complicated. Some languages also abstract away some kinds of state, in ways that aren't available to your program. For example, a basic
foreach
loop that iterates across an object. Not all languages make the internal pointer mechanisms available via variables (or at all), but there's certainly a state being managed there.On the flip side, HTML has none of that. It describes content, and that's it. At a basic level, you could compare an HTML document to information stored in memory. Each block of memory (e.g. each HTML node) has a start and end position, and can have pointers to a parent, previous and next sibling, and x number of child nodes. There's nothing beyond basic connections between items, no concept of any programming functionality.
So you claim there is "the industry definition". I wonder how we can get a definition of that kind. Was there an industry wide vote or something? I missed my invitation.
Just to prevent: If you gonna use quote from Wikipedia as proof. This is not an industry wide definition. This is just a definition of website called Wikipedia.
There is no such thing as industry wide definition. There are people who believe in one definition and people who believe in another. For example Professor Brailsford thinks that HTML is declarative programming language youtube.com/watch?v=4A2mWqLUpzw
Peter Van Roy has a separate category "Descriptive declarative programming" which includes XML, S-Expressions info.ucl.ac.be/~pvr/VanRoyChapter.pdf. HTML also would be in that category
That is why I'm asking for a definition. I'm trying to understand your logic. But for some reason you try to prove me wrong instead of explaining what you mean
He explained plenty what he meant and you ignore half of his text. Even the official definition of HTML which classifies it as a markup language by its own creator was ignored by you 😂
I said it before. There is no proof that markup language can't be a programming language as well. What about Postscript?
Here is another definition of a programming language:
1: w3.org/TR/html52/syntax.html#syntax
2: w3.org/TR/html52/dom.html#elements...
Just to remove this argument about "official definition"
Why you keep changing the subject we are talking about html and not postscript not brainfuck not javascript.
Waste of time I'm going back to blocking you. If you can't even read a simple rfc which is written by the creator of the languages then clearly you have ko will to learn.
Peace out
I'm trying to have a constructive conversation. Stop freaking out. I'm asking simple straightforward question and instead of answering the question you start to attack argument, which I haven't made.
It is called "strawman"
You assume that you are totally right and there is no chance that other person can be right. Let me introduce you to the work of David Dunning and Justin Kruger britannica.com/science/Dunning-Kru...
No I think that is you. To safe keep your argument you're comparing two different things Query Language with Markup Language. If you would be trying to be constructive you would compare 2 Markup languages.
Please stop overreacting.
I asked for a definition of "program". Not a "programming language". I don't see where you gave a definition for a "program"
Markdown is certainly a DSL, it expresses an information structure (as does HTML), which is render-able to multiple output types to make that information intelligible to whomever or whatever is consuming it. It comes down to a definition of 'programming', I would support the view that any instructions that control a system/machine are programming instructions, so yep, Markdown is a programming language...
Totally disagree.
By its name HTML is:
For me a programming language is a language where you can write instructions leading to algorithms or various computations
You don't have loops then it is not a PL and before it gets mentioned yes even assembly which is one of the lowest level language harbors loops.
HTML and MD do not have these capabilities and therefor I classify them in the category of Markup Languages.
Below is a good explanation of the difference between Markup Languages / Programming Languages:
geeksforgeeks.org/difference-betwe...
softwareengineering.stackexchange....
I think that the "name" argument is unsound. It's like saying sea lion is a lion because it has a lion in its name. Why markup language can't be a programming language? If you think this is a sound argument, please explain it to me.
That is a definition. I agree with the essence of it.
HTML has instructions (tags) that make the machine do computations - a machine changes output depending on those instructions (font size, layout, color, etc.). Other machines can do other changes in response to instructions, like add two numbers and store them in the memory...
This is the second addition to the definition. Only loops are required or something else? Are loops bounded or unbounded? (Trying to understand if you are going for Turing completeness or not)
Once again I disagree. The naming convention when creating the Internet where very strictly chosen and regulated for some.
They are also bodies that look into making rigorous standards:
Its not a description of what you see but a description of what it does. This was created to make the Internet work not to have fun creating a golfing language.
I'm sorry but I don't consider tags instructions. Languages are made of tokens and yes that can be tags as that is what is parsed.
Instructions are like operations. Per the name it instructs to do something.
GO TO
LOOP
ETC
I think you forgot the most essential part of the definition.
Leading to algorithms or various computation
Could you create a function for the Fibonacci sequence in HTML?
Can you calculate the square root of a number?
Can you do bitwise operations?
Not really as it is a markup language for grouping visual elements into groups.
You claim they use rigorous methodology to name languages. Can you provide a link to the document where those rules for naming languages are described?
tools.ietf.org/html/rfc1866
I'm not gonna go through all the RFC but any you can have a look and see other documents such as: Internet Official Protocol Standards
Also the link I gave you is the official proposition by Tim Berners Lee for HTML. It is clearly said in the first paragraph:
It was clearly defined as a Markup Language not a Programming Language.
I'm also still waiting the code to my previous question on creating algorithms in HTML.
It is an RFC for HTML itself. It does not say that markup language can't be a programming language as well. We back to the argument sea lion is a lion because name says so
What the h? did you ever read the links? Since when is a markup language a programming language there's a big difference.
And why you keep ignoring the other point? Please reply to this comment with a algorithm in html for printing out fibonacci numbers.
Why is it you only read half Of what everyone is saying. And actually your sea lion example is really stupid because your looking at the common name and not the scientific name.
Sea lion = otariinae from the caniformia suborder.
Lion = pantera leo from the feliformia suborder.
Who if you look at the regulated name just like the rfc html Is not a programming language but a markup language. Even Wikipedia calls it a markup language.
If you took the time to do your research and read the rfc you would see it even references the iso that it respects. But if you don't take time to read definitions, standards and more I guess I know where you're confusion is coming from
Or maybe its out you're trying to become famous through stupidity?
Anyhow here is a list of differences between markup language and programming languages.
thecoderpedia.com/blog/is-html-a-p...
medium.com/@mohitsudan302/do-you-w...
cirdangroup.com/cirdan-blog/2017/1...
geeksforgeeks.org/difference-betwe...
STILL WAITING YOUR HTML ONLY FIBONACCI SEQUENCE
Please provide a proof for this claim.
EDITED SAME LINKS as before which you didnt bother to read
STILL WAITING YOUR HTML ONLY FIBONACCI SEQUENCE
So your argument is that programming language suppose to be able to do Fibonacci numbers. Ok. But it has nothing to do with the name, right? That what I tried to explain to you. It's two different arguments
is not two different things do you even read people's comments omg
Please code algorithms or perform computations with HTML
if you read the four links i added theyt say exactly the same. Let me quote it to you since it seems you can't even open a link
Wikipedia cause you probably forgot to read that too:
en.wikipedia.org/wiki/Programming_...
Algorithms, algorithms, algorithms
Maybe you don't know what that is and hence your confusion. With your lack of motivation to instruct yourself and learn new things:
From the oxford dictionary
oxfordreference.com/view/10.1093/o...
And for the sake of it the Cambridge one:
dictionary.cambridge.org/dictionar...
So please do code a nice efficient algorithm in HTML or a Mathematical Operation I gave you examples earlier but you ignored them like half the texts that don't go in your direction
So i'll defo accept HTML as a Programming Language the day it is renamed HTPL or the day someone makes a proper algorithm in HTML only.
Per the official body that handles HTML development:
html.spec.whatwg.org/
Still no algorithm planned for HTML6 yet though but who knows maybe 7.
Anyhow as Albert Einstein once said:
I guess today I realized how true that statement can be.
Good luck on your future HTML algorithm if you ever manage.
Peace out
blocked
Einstein probably didn't say that quoteinvestigator.com/2010/05/04/u...
Yes its your definition.
You misunderstood HTML it does not say how and it does no rendering.
HTML is predefined and you just say where the browser should render things. The Browser renders things. Its more like a configuration.
If you don't agree - provide your own definition of PL.
Programming is all about configuring a machine
Why does it matter?
From a practical point of view, it doesn't. I'm, as a programmer, can write code and machine will go brrrrrrr.
But it is an interesting question because it tells us something about our industry:
Some comments may only be visible to logged-in visitors. Sign in to view all comments.