Green Files

Is HTML a programming language?

Day: 06/01/2022 - Time: 09:56:02

This is a question and a common mistake. HTML is a markup language as its name implies. HyperText 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. 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 characteristics to be able to "program a device". You can't run HTML, that's why you need JavaScript to do some things, it's a programming language. Both can even be considered computer languages, but that's it.

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

Turing machine

HTML is far from Turing complete. She would need to have all these capabilities:

-do calculations;

-change information contained in some kind of memory;

make decisions;

-change the flow of execution.

Alan Turing created a minimal theoretical machine that allows these operations to be performed, and it was assumed that any

programming language needs to be able to perform 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 cannot do all Turing machine operations.

Furthermore, a markup language alone does nothing. In theory you could even create a machine that would "understand" a markup language and do something but I doubt that would be of any real use. In practice, in current technology, these languages ​​only work because they are interpreted by software that was 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 each thing has, otherwise anything could be a programming language, even the ASCII table can be considered like that because there is a set of rules and its use instructs in a limited way as a computer must operate. One could argue that the definition is arbitrary, but it makes sense, it's useful for classification, it was invented early on in modern computing, and it doesn't pose any problems.

Can another criterion be invented? Of course you can, but why? 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 a thought exercise it can be interesting, but it has no practical motivation, so anyone who insists on it borders on insanity.

The classification of languages ​​that is done today serves the community well. People who want to question are welcome, but if one wants to change what has been established and establish a new norm, one needs to convince people, give concrete data, show serious research that changes it 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 ​​that end 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 programming language.

So SQL must 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 on the market, mainly for working with stored procedures, are more complete and can therefore be considered Turing equivalent (just an alternative/synonym name).

CSS is a styling language and it's not a programming language either.

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

Both programming and markup languages ​​can be declarative or imperative. They are different concepts. There can 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's just using a subset, but it can be used as a form very similar to JSON which is also JavaScript based ML which is a PL. There are certainly other languages ​​that have a syntax that makes it easier to use as a markup language.

If we consider HTML5+CSS3 as a single language, then it becomes more complicated to say whether this can be considered a programming language. It would certainly be a pretty weird PL to use but it can do all the 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're on the wrong path to doing this job. In addition to knowing how to communicate better with your professional peers (including here), there is an important cognitive effect when you try to do and define things the right way. You are a reflection of what you practice. Nobody is muscular without doing physical effort (not even taking a bomb). No one will "communicate with the computer" properly if they don't exercise accurate communication in everything in life. I'm not saying you need to know everything, that you can't go wrong, which would be naive, but you need to make the effort and keep that in mind. I don't know a little switch in the brain that turns on or off the ability and need for correct communication, I just wish I had a compiler to help me point out my mistakes when I'm not programming.

Reference:

https://pt.stackoverflow.com/questions/35547/html-%c3%a9-uma-linguagem-de-programa%c3%a7%c3%a3o

GO UP
GO TO INDEX