Is HTML a programming language?

It is not my intention to bring the confusion of others to the site, but it was a doubt of mine (internal, of those things that you are sure and then someone comes and asks a question that messes with the old certainties). I saw on this site, the ranking of the top 10 programming languages, and noticed that for some people HTML is a programming language and for others not.

Doubt:

HTML is a programming language or not?

Author: Comunidade, 2014-10-10

4 answers

No.

This is a doubt and a common mistake. HTML is a markup language as its name says. Hyper Text Markup Language . More broadly it can be considered a data language. HTML just encapsulates data and describes what to do with it, not how to do . It is defined in the English Wikipedia .

A web browser can read HTML files and compose them into visible or audible web pages. The browser does not display the HTML tags, but uses them to interpret the content of the page. HTML describes the structure of a website semantically along with cues for presentation, making it a markup language rather than a programming language.

It is not a programming language because it is not Turing complete. That is, it would need to have some specific features to be able to"program a device". You can't run HTML, which is why you need JavaScript to do some things, this is a programming language. Both can even be considered computational languages, but stop there.

Semantics: you program and / or code in JavaScript but only code in HTML (you create a code that declares a form of presentation).

Turing Machine

HTML is far from having the completeness of Turing. She would need to have all these capabilities:

  • make calculations;
  • change information contained in some type of memory;
  • make decisions;
  • change the execution flow.

Alan Turing created a minimal theoretical machine that allows to do these operations and it was considered that any programming language needs to be able to do all the operations of this universal machine.

These non-programming languages help instruct devices (computers with software, for example) to perform some task, but a markup language has its ability to do this very limited, it can not do all operations of the Turing machine.

Besides this a markup language alone does nothing. In thesis you could even create a machine that would "understand" a markup language and do something but I doubt this would have any real use. In practice, in today's technology, these languages only work because they are interpreted by software they were created with... programming languages.

Why do we adopt the Turing machine as a parameter to define what a programming language is? You need to establish a cut, give a line where has every thing, otherwise anything could be a programming language, even the ASCII table can be considered so because there is a set of rules and their use instructs in a limited way how a computer should operate. It can be argued that the definition is arbitrary, but it does sense, it is useful for classification, was invented at the beginning in modern computing and does not bring problems.

Can another criterion be invented? Of course it can, but for what? There are those who claim that 1 plus 1 is not 2. It may be true, but what gain will we have in changing this concept? As an exercise of thought it can be interesting, but it has no practical motivation, so anyone who insists on it borders on insanity.

The classification on languages that is done today serves the community well. People who want to question are welcome, but if the person wants to change what has been established and set a new norm, he needs to convince people, give concrete data, show serious research that changes this and give motivation for change. This is different from just correcting a misunderstanding on the part of some things and what official documents say otherwise, as I did in What is the difference between attribute and field, in classes?.

Other languages

In general languages ending with ML are markup languages, see XML . Of course this is just an initial idea, there is a programming language called ML (Meta Language) and several derivatives of them (SML, CAML, OCAML, etc.). Although it is not in the name of most programming languages the acronym PL ends up being associated with them in some way. A case where the name has the acronym is PL / SQL which is obviously a language of schedule.

So SQL should be a programming language, right? No, at least in its ANSI version it is not Turing complete. The extensions provided by the main database systems of the market, mainly to work with stored procedures , are more complete and then they can be considered Turing equivalent (only an alternative name/synonym).

CSS is a language of styles and is also not a language programming.

Already XSLT (Extensible Stylesheet language Transformations) is a declarative language like most markup languages but it is a programming language since it allows to do all computations of the abstract Turing machine.

Both programming and markup languages can be declarative or imperative. They are different concepts. There may be confusion because it is more common for PLs to be imperative and MLs to be declarative.

Lua is a PL that is used as a markup in some situations. Of course it is the use of only one subset, but it can be used as a very similar form to JSON which is also JavaScript based ML which is a PL. There are certainly other languages that have a syntax that makes it easy to have use as a markup language.

If you already consider HTML5+CSS3 as a single language then it becomes more complicated to say if this can be considered a programming language. It would certainly be a very strange PL to use but it can do all minimal computations, right? See Rule 110 .

Why is knowing this important?

Because computing is an exact science, when you don't care about the accuracy of things you are on the wrong path to accomplish this work. In addition to knowing how to communicate better with your peers of profession (here included), there is an important cognitive effect when you seek to make and set things the right way. You are a reflection of what you practice. No one is muscular without doing physical exertion (or taking pump). No one will "communicate with the computer" properly if he does not exercise accurate communication at all in life. I'm not saying that you need to know everything, that you can not go wrong, which would be naive, but you need to strive and always keep this in mind. I do not know a key in the brain that turns on or off the ability and need for correct communication, that just wanted to have a compiler to help me indicate my errors when I'm not programming :) .

 139
Author: Maniero, 2020-09-09 17:12:15

No. HTML is a hypertext markup language

HTML is a markup language, it is used for structural purposes. HTML encapsulates or marks data within HTML tags, the browser then reads and interprets the content and can display differently, titles, paragraphs, links, tables and etc...

HTML is not an executable script, as said, HTML is used for structural and non-functional purposes, so is not a programming language. HTML does not contain no programming logic, it is not possible to create for example conditional structures like IF / ELSE, it is not possible to declare functions or perform calculations. With HTML it is not possible to manipulate or modify data in any way.

And if someone insists, ask him to make a code that calculates 1 + 1 in HTML.

 39
Author: abfurlan, 2014-10-10 16:07:34

HTML, HyperText Markup Language, it is not a programming language, it is just a markup pattern, as said in @Maniero's answer, HTML is not executable, it needs an interpreter to read its markups, and the interpreter is the browser itself.

XML, JSON, SVG, CSS, RSS among others are standards like HTML.... they serve different and/or similar purposes, depending on your need, do not come to be a language of programming, but serve as reading standards.....again I give a focus on this part: they are not compiled language, but rather "interpreted", browsers interpret them, and show the result on the screen.

Of course the idea of Compilation and interpretation is very similar.... But something that can make this view clear let's use as an example JAVA and XML

When creating a system in JAVA, and compiling it, it would run equally on any computer that own the JVM (Java Virtual Machine )

In the case of XML, depending on its implementation, it can serve N purposes and with N differences.

Nor do we need to go too far, an HTML page even, depending on the browser you use(Chrome, Opera, Safari, Firefox and Microsoft's Little Blue Monster, better known as IE), it will interpret the bookmarks of the page in a different way than another.

 18
Author: MarceloBoni, 2017-11-01 12:52:01

Hum ... although resurrecting an old question is a dubious attitude, I will answer and disagree with the current: yes, HTML is a programming language. I will simply copy excerpts from an answer I already gave on Quora :


This is a question of definition.

A programming language is a formal language - a vocabulary plus rules - used for a computational device to perform a given task.

In this sense, says David A. Schmidt in his book "Denotational Semantics":

Any notation for giving instructions is a programming language. Arithmetic notation is a programming language; so is Pascal. The input data format for an applications program is also a programming language. The person who uses an applications program thinks of its input commands as a language, just like the program's implementer thought of Pascal when he used it to implement the applications program. The person who wrote the Pascal compiler had a similar view about the language used for coding the compiler. This series of languages and viewpoints terminates at the physical machine, where code is converted into action.

In ptBR:

Any notation for providing instructions is a programming language. Arithmetic notation is a programming language; so is Pascal. The input data format for an application is also a programming language. The person who uses a application thinks of command input as a language, as well as the program implementer thought of Pascal when using it to implement the application. The person who wrote the Pascal compiler had a similar view about the language used to implement the compiler. This series of views and languages ends in the physical machine, where code is converted into action.

This description certainly encompasses HTML-with emphasis on " the data format of input to an application is also a programming language " .

On the other hand, there are some problems with not considering HTML as a programming language. First, a little theory.

In computational theory, one usually learns three formalisms (among many others): the finite automaton, the stack automaton, and the Turing machine. All three formalisms are "programmable".

For example, you can construct a finite automaton that checks if the Word "HTML" appears in a given text. And this is certainly a computational task, and I don't need immense computing power (in the sense of theoretical possibility, not performance) to solve it.

As another example, you can build a stack automaton that checks if a given text is with balanced parentheses. This is a computational task, and it does not take immense computational power to solve it. A little more than an automaton finite, certainly, but not a complete Turing machine.

And as a last example, a Turing machine is required to compute whether all the letters of a given text appear in equal quantities.

Intuitively, all these tasks are computational, it's something hard to deny. So it's very strange to deny that the " formal computers "that run them are not computers, much less that they are not" programmable " in some sense. If only the Turing is a programming language, why aren't the other two?

With this, it is established that programmable machines are not restricted to Turing, and therefore programming languages are not restricted to Turing-complete.

With this, one wonders: why do many people say that HTML is not a programming language?

I would say that by sheer ignorance (here, synonymous with ignorance) or by breaking expectation. There are some objections common

For example, one usually thinks more of programming languages with some form of interactivity, such as getchar(). But this is a narrow idea. There are many complex programs without many points of interaction with the user. Video card Drivers and computer BIOSes, for example.

Other times, it is claimed "but HTML is a formatting language". But this is a false dichotomy. After all, HTML is a formatting language, so it is a language (vocabulary plus rules) used for a device (Internet Browser) perform a task (namely formatting). Therefore, it is a programming language and formatting, both at the same time.

Others may State " but it is not Turing-complete "(or the equivalent"makes an operating system in HTML"). This is also not very correct. There are Domain Specific Languages that don't even care about being Turing-complete, like ANSI SQL92, Coq and Agda.

About Coq, we can even resort to the official website :

Coq implements a program specification, and the mathematical higher-level language called Gallina, that is based on an expressive formal language called the Calculus of Inductive Constructions (that itself combines both the higher-order logic, and a richly-typed functional programming language.

Finally, to land this false dichotomy: the language of TeX formatting is admittedly Turing-complete.


 -5
Author: Anderson Torres, 2018-11-26 15:21:54