DEV Community

Vipul
Vipul

Posted on

Programming Languages - A comparison with Human Languages

Disclaimer

This mess is a lighthearted read, and uses the F word once, with some other weird stuff, so if you are sensitive about that sort of thing, I am sorry and these are just jokes. Enjoy the read and hey, if you like some of the jokes, I go by @vipulbhj on Twitter and I don't hate compliments :p.

P.S: Wait, does anyone hate compliments, DM me if you do, I am curious and also I love you and being different is awesome.

Programming Languages

I recently encountered this tweet where the user was curious on how programming languages compare to the other more familiar human languages. This reminded me of all times when I wondered if programming in Hindi will it make my code safer, since non Hindi speakers wouldn't be able to read my code :p

So in this blog(blabbering session), I will try to deep dive(to anxious overthinking depth levels) into this subject. So, let's go....

What is language

According to Wikipedia, Language is ummm.. you know what, forget this. You are reading this just fine, fair enough that proves you know what a language is, no mansplaining here, this is a safe space, or is it (EVIL LAUGH)

Yeah so whatever, back to the subject. So, since you already know what a language is, you also know it has some components, let's talk about those.

Components of Language

Although, based on the perspective and the research you are looking at, googling for components of language will give you a lot of results, but it all essentially boils down to,

  • Letters -> atomic core of the language, finite and unchanging.

  • Words -> first layer of abstraction, ordered combination of letters which have a specific meaning(I have no clue how this works, but somehow the whole fk world just accepts, okay this combination means this, like how, seriously, what's the process of formally expressing denial here) and rhyme(lets face it, pronunciation is a lame word), over time new words can be are added and rarely old ones are removed, but trends change, thing become uncool and and people stop using it by choice.

  • Sentences -> second layer of abstraction, introduces the concept of Grammar.

And using these, I could blabber all the things you just read(sorry, not sorry).

What is Programming Language

Who wants to ask Wikipedia, yup no one, just as I figured.

So, programming language allow humans to communicate with computers, and control them and feel like Mojo Jojo, by making the most awesome evil plan ever to destroy the Powerpuff Girls

Yup you can do that, and it's freaking awesome, but also don't, like just don't. And moreover, you already know what a programming language is, else what are you doing here, huh, huh, no tell me NO.

Btw fun fact, programming languages don't have a notion of Time, Emotion, etc. So the code you write in Java, or Python or something else may feel like it has something to do the English language, but actually has no connection at all. They just share the same character set and that was also just because where these was initially developed.

Programming languages provide support for arbitrary text. For example, say a document is written in Spanish, and contains a paragraph written in English. Now if a given individual, who has no clue what English looks like, reads that text, to the reader the english bits mean nothing and they will simply just ignore them and move to the bits they can read.

Now most human languages don't define rules of intermixing of languages, since this is not something they expect the user to be doing and even when it's done, it relies on the consumers understanding of various languages.

But we frequently use arbitrary text while programming and that raises a problem, how do we know which bits are part of the language and which bits are just strings(arbitrary text to be ignored). And to avoid this confusion, each languages defines it's own special way to make something a string.

Let's look at the Javascript code below,

console.log("Hello World"); 
// prints 'hello world' on the console screen
Enter fullscreen mode Exit fullscreen mode

In Javascript, everything inside double quotes is treated as a string, so apart from the Hello World, everything is part of the language, even the double quotes, YES the double quotes is not part of the arbitrary text, but part of the Javascript language.

Components of Programming Language

In general the notion of letters doesn't exist in programming languages. If the character set used (ASCII, UTF-*, etc) supports the symbol, then it's valid and acceptable.

Most programming languages start from keywords, which is an ordered collection of symbols with a specific meaning(a.k.a word in human language). These are finite in number and don't change for a specific version of the language. Keywords are things like if, else, for, while, let, const, etc.

The notion of grammar is mostly similar to any other language, defining rules of keyword usage.

So can you code in any Language ??

Most definitely yes. At the end of the day, computers only understand assembly language, which are direct instructions your CPU understands. The only problem with writing Assembly directly is, it's not a great experience and an overkill for almost 99.99% cases, but hey if you think you like it, write Assembly, and make those Powerpuff Girls suffer (EVIL LAUGH).

But wait, how does Python work then. Well you already know compiler and interpreter right, yeah that's it. Python uses a compiler to convert your code to binary and that shit feels like magic.

But also, did you know, your could program with spaces and tabs, or even better with emoji.

Top comments (0)