It's a language you use to give certain instructions to your computer, right? Let's be a little more precise.

Programming language

According to Wikipedia, a programming language is a

is a formal language, which comprises a set of instructions that produce various kinds of output.

An instruction can be to declare or define a variable, instantiate a class, or to write "Hello World" to the console. So, a programming language is a special kind of formal language; one that produces instructions.

Formal Language

Going back to Wikipedia, a formal language

consists of words whose letters are taken from an alphabet and are well-formed according to a specific set of rules.

As I suggested earlier, a programming language is a special formal language. To put it another way, a formal language is a more general concept to the same problem. It uses the term of words, letters, and alphabet.

For example, in English, I can start a sentence with "I am", but I cannot start with "I are". There is a rule there: if I say I, the next word can be the auxiliary verb am, or almost any other word, but it cannot be are. Probably you would understand me, but if you were a computer you would refuse to do so. Based on a set of Part-of-Speech, one could come up with a set of rules to cover the basic rules of English.

Turning back to programming languages, in the definition above, if you substitute

  • words to instruction sequences
  • letters to instructions
  • alphabet to set of keywords
  • and formal language to programming language,

you come to the following definition:

A programming language consists of instruction sequences, whose instructions come from a set of keywords and are well-formed according to a specific set of rules.

Finite automatons

Now that we saw how programming languages relate to formal languages used in computer science, we can make the same connection for finite automatons and JavaScript engines.

Back to the English example, if you understand English, you possess a set of words, expressions and grammar rules. If someone starts to talk German, and you have never learned German, you don't have the required knowledge of words and rules to understand.

Having these words and set of rules make you understand a language, to put it the other way, your mind builds up an automaton.

An automaton that understands four sentences: "I am happy", "I was happy", "We are happy", "We were happy"

JavaScript Engines

JavaScript Engines in browsers like V8 (Chrome), JavaScriptCore (Safari) and SpiderMonkey (Firefox) obviously uses a much more complicated way to interpret JavaScript in the browser, but it all based on the idea of Finite State Automaton. And they all implement ECMAScript.