Is HTML a programming language?

Asked

Viewed 35,777 times

124

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

Doubt:

HTML is a programming language or not?

  • Look I believe that not for all I read in the answers here and in the links indicated, but I would not consider a "mistake" put in the curriculum on the part of Programming Languages because if we who are in the IT area are discussing it is certain that a HR will not have this certainty and for lack of this information may find that you are unaware of this "markup language" and get you out of a possible interview.

4 answers

141


Not.

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

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 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 cannot run HTML, that’s why you need Javascript to do some things, this is a programming language. Both can even be considered computational languages, but so on.

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

Turing machine

HTML is far from having Turing completeness. It would need to have all these capacities:

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

Alan Turing created a minimum theoretical machine which allows to do these operations and has passed to consider 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 cannot do all Turing machine operations.

Besides, a markup language alone does nothing. In theory you could even create a machine that would "understand" a markup language and do something but doubt that this would have any real utility. In practice, in today’s technology, these languages only work because they are interpreted by software that has been 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 you have each 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. One could argue that the definition is arbitrary, but it makes sense, is useful for classification, was invented early in modern computing and brings no problems.

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

The classification of languages that is made today serves the community well. People who want to question are welcome, but if the person wants to change what has been established and establish a new standard, they need to convince people, give concrete data, show serious research that changes this and give motivation for change. This is different from just correcting a misconception 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 the 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 somehow. A case where the name has the acronym is the 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 in the market, mainly to work with stored procedures, are more complete and can be considered Turing equivalent (only an alternative name/synonym).

CSS is a style language and is also not a programming language.

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

Both programming and marking 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.

Moon is a PL that is used as marking in some situations. Of course it is the use of only one subset, but it can be used as a form much like JSON which is also Javascript-based ML which is a PL. Surely there are other languages that have a syntax that make it easy to use as a markup language.

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

Why knowing this is important?

Because computing is an exact science, when you don’t care about the accuracy of things you’re on the wrong track to accomplish this work. Besides knowing how to communicate better with your peers (including here), there is an important cognitive effect when you try to do and define things in the right way. You are a reflection of what you practice. No one is muscular without doing physical effort (nor taking pump). No one will "communicate with the computer" properly if they do not exercise precise communication at all in life. I’m not saying that you need to know everything, that you can’t make a mistake, which would be naive, but you need to push yourself and keep this in mind. I don’t know a buzzword in the brain that turns on or off the ability and need for correct communication, I just wanted to have a compiler to help me point out my mistakes when I’m not programming :) .

  • Good perceived @Maniero (welcome to the club of those who believe in it), however, in HTML we somehow "instruct the computer" what and how to show things right?

  • 2

    @Cold makes a drawing and the browser translates graphically. But there are no algorithms in HTML, for example. The day someone can make a sum in HTML, we can talk about it being a programming language ;)

  • BTW +1 by reference to Turing completeness.

  • 26

    Excel is a programming language (vote here if you agree)

  • 60

    Excel is NOT a programming language (vote here if you agree)

  • 4

    It is possible to do mathematical operations, store values, recover them and make conditional deviations in Excel formulas (without VBA). This means that the formulas are Turing-complete?

  • 1

    Would Excel be the most used programming language in the world then? rs

  • 1

    @fernandodelrio for you I don’t need to answer :D But there is doubt for others.

  • 3
  • 5

    Well, Miguel Angelo had already posted a link that shows that Excel can be considered a programming language. Which would make it the most user-friendly programming language in the world. Although there is evidence that it may have all the characteristics necessary to be considered so there are those who do not agree https://news.ycombinator.com/item?id=429505. It was curious to see that the majority voted that it is not.

  • Excel is nowhere near a programming language. Even the formulas are written in VBA, it is just a transformation so that simpler users practice everything that VBA does behind a "Design View" of spreadsheets, that’s all that is Excel.

  • 3

    @you need to get better informed, here is not space to discuss the subject but what has in the response and in the comments make it clear that people who study deeply the subject consider it is.

  • 2

    @Maniero Yes, I voted 12 times in the comment up there, it’s not even?

  • 3

    The information I have and everything I know about languages (and it’s the area of computing I like best) Excel is a programming language. I accept that there are divergent positions. Just post a substantiated information that states this with concrete arguments.

  • CSS is a programming language? It can do calculations (calc(5 -3)), can change information (hover), makes decisions and changes the flow of execution (@media).

  • @Patrick But there are limitations, she can’t solve all kinds of problems.

  • 2

    At the time I voted that I believed that excel was not programming language, today I changed my concept a lot, and I believe that YES, excel is a programming language

Show 12 more comments

39

No. HTML is a hypertext markup language

HTML is a markup language, 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 so on...

HTML is not an executable script, as said, HTML is used for structural and non-functional purposes, therefore is not a programming language. HTML does not contain any programming logic, it is not possible to create conditional structures such as 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 them to make a code that calculates 1 + 1 in HTML.

  • 1

    kkkk, recommend to take a look at the link I put to the site that "incited" some doubt, you will find "interesting" some counter-arguments.

  • 3

    <div>1 + 1</div><div><strong>2</strong></div> Done =P

  • @Marceloboni acertouuuuuu

18

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

XML, JSON, SVG, CSS, RSS and more are standards like HTML.... they serve different and/or similar purposes, depending on your need, do not become a programming language, but serve as reading patterns.... again I focus on this part: they are not compiled language, but "interpreted", the 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 but let’s use as an example JAVA and XML

When creating a system in JAVA, and compiling it, it will also run on any computer that has 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 the Microsoft Blue Monster, better known as IE), it will interpret the page markups in a different way than another.

  • I understood your point, and if you think we should close use the option to close friend @Marcelo Bonifazio. I was left with a question in what I said, all the languages interpreted are not programming friendly?

  • 5

    The part that answers the question is right but this comparison with interpretation and with Java is a little misleading (misleading?).

-5

Um ... although resurrecting an old question is a dubious attitude, I will answer and disagree with the current: yes, HTML is programming language. I’ll just copy snippets of a reply I already gave on Quora:


This is a matter 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, states 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 implementor 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.

En:

Any notation to provide 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 an application thinks of the input of commands as a language, as well as the program’s implementer thought of Pascal when using it to implement the application. The person who wrote the Pascal compiler had a similar view of the language used to implement the compiler. This series of views and languages closes in the physical machine, where the code is converted into action.

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

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

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

For example, it is possible to build a finite automaton that checks whether the word "HTML" appears in a given text. And this is certainly a computational task, and I don’t need an immense amount of computing power (in the sense of theoretical possibility, not in the sense of performance) to solve it.

As another example, it is possible to build a stack automaton that checks whether a given text is in balanced parentheses. This is a computational task, and it doesn’t take a huge amount of computational power to solve it. A little more than a finite automaton, 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 hard to deny. So it is 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 machine is a programming language, why aren’t the other two?

This establishes that programmable machines are not restricted to Turing machines, and therefore programming languages are not restricted to Turing-complete machines.

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

I would say that out of sheer ignorance (here synonymous with ignorance) or out of expectation. There are some common objections

For example, one usually thinks more about programming languages with some form of interactivity, such as getchar(). But this is a restricted idea. There are many complex programs without many user interaction points. 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) to perform a task (namely, formatting). So it’s a programming language and formatting, both at the same time.

Others may say "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 (Domain Specific Languages) that do not even care about being Turing-complete, such as ANSI SQL92, Coq and Agda.

On Coq, we might even resort to official site:

Coq Implements a program Specification and Mathematical Higher-level language called Gallina that is based on an expressive formal language called the Calculus of Inductive Constructions itself combines Both a Higher-order Logic and a Richly-typed Functional Programming language.

Finally, to break down this false dichotomy: the formatting language Tex is admittedly Turing-complete.


  • 3

    Logo CSS and XML are also programming languages? By the way, it is not a dubious attitude to disagree, no. as long as it makes clear all the disagreements and presents counter-arguments :D (not entering into the merits whether it did it or not, just clarifying)

  • 1

    I can also pass a JSON file to a device for it to perform tasks. In this case JSON would be a programming language?

  • 1

    There is actually an esolang based on JSON - a Ajsone: https://esolangs.org/wiki/Ajsone

  • 1

    Finite and stack automata are not programmable. They are programs themselves. A Turing machine is also a program, but a program that accepts another program to make a computation.

  • 1

    It depends on what you mean. Generally speaking, a finite automaton is a description of a machine. This description is a program, but it is not a program that would be run by a finite automaton. In this sense, a particular implementation of formalism JFLAP does that.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.