DEV Community

Quiz: is this a programming language?

stereobooster on January 17, 2021

Definition I would say that something is programming language (PL) if: 1: there is a machine that can do some actions (computations) b...
Collapse
 
shalvah profile image
Shalvah • Edited

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).๐Ÿค”

Collapse
 
stereobooster profile image
stereobooster

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.

Collapse
 
ashleyjsheridan profile image
Ashley Sheridan

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)

Thread Thread
 
stereobooster profile image
stereobooster

I don't think that your definition of a programming language is actually what is the agreed upon definition in the industry.

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.

  • HTML is series of instructions (tag is an instruction for the computer, which says, for example, make font bigger)
  • used to implement algorithms. We need to agree on what is algorithm
  • HTML is executed, in sense that machine takes instructions and produces some output based on those instructions
Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

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.

Thread Thread
 
stereobooster profile image
stereobooster

There are industry definitions for a programming language, that's not my definition, it's me trying to explain it.

Please provide the source

Collapse
 
crimsonmed profile image
Mรฉdรฉric Burlet

Totally disagree.

By its name HTML is:

Hypertext Markup Language
Enter fullscreen mode Exit fullscreen mode

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....

Collapse
 
stereobooster profile image
stereobooster • Edited

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.

For me a programming language is a language where you can write instructions leading to algorithms or various computations

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...

You don't have loops then it is not a PL

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)

Collapse
 
crimsonmed profile image
Mรฉdรฉric Burlet • Edited

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:

  • W3C
  • IETF they regulate the (RFC)

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.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

The naming convention when creating the Internet where very strictly chosen and regulated for some.

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?

Thread Thread
 
crimsonmed profile image
Mรฉdรฉric Burlet

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:

The Hypertext Markup Language (HTML) is a simple markup language used to create hypertext documents that are platform independent.
Enter fullscreen mode Exit fullscreen mode

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.

Thread Thread
 
stereobooster profile image
stereobooster

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

Collapse
 
_genjudev profile image
Larson

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.

Collapse
 
stereobooster profile image
stereobooster • Edited

If you don't agree - provide your own definition of PL.

Its more like a configuration

Programming is all about configuring a machine

Collapse
 
gilfewster profile image
Gil Fewster

Why does it matter?

Collapse
 
stereobooster profile image
stereobooster • Edited

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:

  • Either our industry is still so young that we can't agree on something that basic
  • Or it differs from every other industry