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

Thread Thread
 
crimsonmed profile image
Médéric Burlet

@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

Thread Thread
 
shalvah profile image
Shalvah

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

Thread Thread
 
stereobooster profile image
stereobooster

Removing text from HTML is like removing IO operations from PHP. Example:

<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
</ul>
Enter fullscreen mode Exit fullscreen mode

vs

for (let i = 1; i <= 3; i++) {
  console.log(i);
}
Enter fullscreen mode Exit fullscreen mode

Now let's "remove text"

<ul>
  <li></li>
  <li></li>
  <li></li>
</ul>
Enter fullscreen mode Exit fullscreen mode

vs

for (let i = 1; i <= 3; i++) {
}
Enter fullscreen mode Exit fullscreen mode

In both cases it will do calculation (browser will build DOM, JS will iterate over i) and in both case we will "see" no output

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

A 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:

1
2
3
Enter fullscreen mode Exit fullscreen mode

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.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

So you say that

console.log(1)
console.log(2)
console.log(3)
Enter fullscreen mode Exit fullscreen mode

Is not a program? Can you give definition for a program so I can differentiate what is program and what is not?

Thread Thread
 
crimsonmed profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Médéric Burlet

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.

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

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.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

I'm glad we figured out that this is a program.

HTML isn't a programming language

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?

Thread Thread
 
crimsonmed profile image
Médéric Burlet

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.

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

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.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

can define functions and procedures.

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

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

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:

  • Loops
  • Branching logic
  • Variables
  • State management

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.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

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

I specifically mentioned that SQL had loops and branching logic

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:

  • Loops
  • Branching logic
  • Variables
  • State management

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?

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

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.

Thread Thread
 
stereobooster profile image
stereobooster • Edited

You seem to have a version of the definition which is yours but it doesn't match the industry definition.

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

Thread Thread
 
crimsonmed profile image
Médéric Burlet

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 😂

Thread Thread
 
stereobooster profile image
stereobooster

HTML which classifies it as a markup language

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:

A programming language consists of (1) a syntax, given as a formal grammar; and (2) a semantics

1: w3.org/TR/html52/syntax.html#syntax
2: w3.org/TR/html52/dom.html#elements...

Just to remove this argument about "official definition"

Thread Thread
 
crimsonmed profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Médéric Burlet

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

 
stereobooster profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
stereobooster

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 misrepresented someone's argument to make it easier to attack.

-- yourlogicalfallacyis.com/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...

Thread Thread
 
crimsonmed profile image
Médéric Burlet

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.

 
stereobooster profile image
stereobooster

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"

Collapse
 
phlash profile image
Phil Ashby

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

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

Thread Thread
 
crimsonmed profile image
Médéric Burlet • Edited

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

Thread Thread
 
stereobooster profile image
stereobooster

Since when is a markup language a programming language there's a big difference

Please provide a proof for this claim.

Thread Thread
 
crimsonmed profile image
Médéric Burlet

EDITED SAME LINKS as before which you didnt bother to read

STILL WAITING YOUR HTML ONLY FIBONACCI SEQUENCE

Thread Thread
 
stereobooster profile image
stereobooster • Edited

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

Thread Thread
 
crimsonmed profile image
Médéric Burlet

is not two different things do you even read people's comments omg

a programming language is a language where you can write instructions leading to algorithms or various computations
Enter fullscreen mode Exit fullscreen mode

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

retar

Programming Languages involve Logical Operations, Arithmetic Operation, and many Algorithms. Whereas Markup Languages just include Tags to define the elements.
Enter fullscreen mode Exit fullscreen mode
A programming language is the proper and formal language that has been designed to allow programmers to communicate instructions to a computer. Programming language is used to create programs.

Programming language is used to transform data by creating CPU instruction that will rewrite the input data into the desired output. This is a language that encodes programs, meaning that a word in the language can be interpreted as a sequence of actions.
Enter fullscreen mode Exit fullscreen mode
 In simple terms, programming languages are set of instructions or code which tells a computer what it needs to do. So basically, we provide a logic or instruction to the computer to perform some task to get the desired output from it.
Enter fullscreen mode Exit fullscreen mode

Wikipedia cause you probably forgot to read that too:
en.wikipedia.org/wiki/Programming_...

A programming language is a formal language comprising a set of instructions that produce various kinds of output. Programming languages are used in computer programming to implement algorithms. 
Enter fullscreen mode Exit fullscreen mode

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

A documented series of steps which leads to the transformation of some data. For example, in order to calculate the sum of a series of numbers a possible algorithm would involve repeatedly adding the numbers to be summed to a running total. Computer programs are a manifestation of algorithms which allow them to be executed very quickly.
Enter fullscreen mode Exit fullscreen mode

oxfordreference.com/view/10.1093/o...

And for the sake of it the Cambridge one:

a set of mathematical instructions or rules that, especially if given to a computer, will help to calculate an answer to a problem.
Enter fullscreen mode Exit fullscreen mode

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 is the World Wide Web's core markup language. Originally, HTML was primarily designed as a language for semantically describing scientific documents.
Enter fullscreen mode Exit fullscreen mode

html.spec.whatwg.org/

Still no algorithm planned for HTML6 yet though but who knows maybe 7.

Anyhow as Albert Einstein once said:

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.      
Enter fullscreen mode Exit fullscreen mode

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

Thread Thread
 
stereobooster profile image
stereobooster

Einstein probably didn't say that quoteinvestigator.com/2010/05/04/u...

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