Index
Version control 1
1 Synonyms and Abbreviations 4
2 History 5
2.1 Origin 5
2.2 Standardization 6
2.3 Application 6
3 Structure and Parsing 7
3.1 Formal Methods of Describing Syntax 7
4 Literature 9
5 Figures 10
1 Synonyms and Abbreviations
• JavaScript, ECMAScript 2015 and ECMAScript 6 refer to the same programming language, albeit the latter two referring to the latest major version at the moment of writing; these terms can be read interchangeably.
• ES6 and ES15 or ES2015 are abbreviations of ECMAScript6 and ECMAScript2015 respectively.
• The term formal language generation mechanism is interchangeably used with grammars.
2 History
During this chapter, the programming language JavaScript will be introduced from a historical perspective. First, the origin of the language will be covered. In the second and final part of this introductory chapter, the problems JavaScript is best suited for will be listed along with some venerable examples of application.
2.1 Origin
In 1995 Netscape Communications, the company behind the Netscape Navigator browser hired Brendan Eich initially to implement Scheme in the browser. (Rauschmayer, 2018) Scheme is a multi-paradigm programming language and dialect of Lisp, which itself is a functional programming language.
Figure 1 Brendan Eich (NNDB, 2018)
Before Eich could start with the implementation of Lisp, Netscape Communications collaborated with the Sun company to include its more static programming language Java . This collaboration rose the debate over the need for two programming languages in the Netscape Navigator browser within Netscape Communications. (Rauschmayer, 2018)
The impetus was the belief on the part of at least Marc Andreessen and myself [Brendan Eich, red.], along with Bill Joy of Sun, that HTML needed a "scripting language", a programming language that was easy to use by amateurs and novices, where the code could be written directly in source form as part of the Web page markup. We aimed to provide a "glue language" for the Web designers and part time programmers who were building Web content from components such as images, plugins, and Java applets. We saw Java as the "component language" used by higher-priced programmers, where the glue programmers -- the Web page designers -- would assemble components and automate their interactions using JS.
In this sense, JS was analogous to Visual Basic, and Java to C++, in Microsoft's programming language family used on Windows and in its applications. This division of labor across the programming pyramid fosters greater innovation than alternatives that require all programmers to use the "real" programming language (Java or C++) instead of the "little" scripting language. (Hamilton, 2008)
They depicted the glue-language, as Eich described it, had to be similar in syntax to Java. (Rauschmayer, 2018) Java, however, is an imperative object-oriented programming language, thus Scheme and Java having poor similarity in syntax they opted for a new scripting language instead. A scripting language more suited aside Java. And instead of having to implement Scheme in the Netscape Navigator browser, Eich had to create a new scripting language instead. In May 1995 Eich created a new scripting language prototype called Mocha, which name later changed into LiveScript for trademark reasons. (Rauschmayer, 2018)
December 1995 saw Java having gained big momentum, Netscape Communications wanted LiveScript to benefit of this and so they made the final name change into the name nearly every developer today is familiar with: JavaScript.
Eich created JavaScript inspired by Java, Scheme and Self. Throughout this paper, these inspirations will be further examined and analyzed.
2.2 Standardization
In 1995 Microsoft started competition on the Netscape Communications browser with their own Internet Explorer. During this period Microsoft became a mortal threat for Netscape, to prevent Microsoft gaining control over JavaScript they started a standardization process.
Figure 2 Netscape Navigator Market share (Wikipedia, Wikipedia, 2018)
2.3 Application
Since its origin JavaScript came a long way. From the scripting language intended to pair along Java in web-browsers, it’s now surpassed Java in usage, and it’s even the most used programming language at the moment of writing. (JetBrains, 2018)
Figure 3 Selection of Top Five Most Used Programming Languages According to Jetbrains (JetBrains, 2018)
Not only in usage JavaScript has grown, but also in the places where JavaScript is being used. Originally designed to be a web scripting language to be used along with a “component language” like Java as Eich explained, JavaScript itself now also run outside the browser using Node.js. Node.js is an asynchronous event-driven JavaScript runtime, in which JavaScript can run similar to the Java Virtual Machine which runs Java. (Node.js, 2018)
Node.js is originally written by Ryan Dahl in the year 2009. (Wikipedia, Ryan Dahl, 2018) Node.js allows for the JavaScript everywhere paradigm by letting both the client and the server being written in the same programming language being JavaScript. Upon Node.js NPM was built, the Node Package Manager.
npm opens up an entire world of JavaScript talent for you and your team. It's the world's largest software registry, with approximately 3 billion downloads per week. The registry contains over 600,000 packages (building blocks of code). (NPM, 2018)
The list of venerable applications written in or partially in JavaScript is prominent, probably containing applications you use on a daily base, and some of the biggest software projects ever existing. Projects like Google, Facebook, Twitter, and LinkedIn all were built using JavaScript.
Following this, it won’t be much of a surprise JavaScript being first and foremost the programming language for web-applications. The sole reason for this being it’s at the moment of writing the only programming language supported by the major web-browsers e.g. Google Chrome, Internet Explorer, FireFox, Safari et cetera.
In all probability this won’t stay the case for good as recently, June 2015, Google, Microsoft, Mozilla and the engineers on WebKit announced WebAssembly. (TechCrunch, 2018)
This allows for newly designed higher programming languages or existing proven programming languages like Python or Java to transpile into web assembly.
3 Structure and Parsing
3.1 Formal Methods of Describing Syntax
The formal methods of describing syntax concern the formal language-generation mechanisms also called grammars. With these language-generation mechanisms or grammars, the syntax of programming languages can be described.
Four grammars are well known for describing a programming language’s syntax, these are:
I. context-free grammar by Chomsky;
II. regular grammar by Chomsky;
III. Backus-Naur Form, surprisingly by Backus and Naur.
IV. and the Extended Backus-Naur Form.
The grammars by Chomsky were not designed with the intent to describe the syntax of programming languages but rather for natural languages, later the application of these grammars for artificial languages proofed to be useful.
The Backus-Naur Form and the Extended Backus-Naur Form were created with programming languages in mind. These forms are called meta-programming languages, languages to describe other languages by a set of metadata.
Using the Backus-Naur Form to describe the syntax of a subset of JavaScript only containing a simple equation and initialization of a constant with the yielded result as:
Will result in the following syntax:
Checking this grammar with a leftmost derivation might results into:
Proving the grammar converges into valid JavaScript.
Notice in the last example grammar the mathematical operators are divided into two distinct categories of lexemes, this is purposely done to prevent ambiguity and preserve the mathematical precedence as found common in mathematics. Meaning if only the token <term> was used containing both the plus, minus, multiplication and division operators, the following line of grammar:
<term> + <term> * <term>;
Has two interpretations, being:
(<term> + <term>) * <term>;
<term> + (<term> * <term>);
The first interpretation is mathematically incorrect, and also ambiguity is generally considered a bad trait describing programming languages.
4 Literature
Hamilton, N. (2008, 07 31). The A-Z of Programming Languages: JavaScript. Retrieved from Computerworld:
https://www.computerworld(...)-investment-splurge/JetBrains. (2018, 10 16). The State of Developer Ecosystem in 2018. Retrieved from JetBrains:
https://www.jetbrains.com/research/devecosystem-2018/NNDB. (2018, 10 16). Brendan Eich. Retrieved from NNDB:
http://www.nndb.com/people/095/000031002/Node.js. (2018, 10 16). About. Retrieved from Node.js:
https://nodejs.org/en/about/NPM. (2018, 10 16). What is NPM? Retrieved from NPM:
https://docs.npmjs.com/getting-started/what-is-npmRauschmayer, D. A. (2018, 10 16). Chapter 4. How JavaScript Was Created. Retrieved from Speaking JavaScript: An In-Depth Guide for Programmers:
http://speakingjs.com/es5/ch04.htmlTechCrunch. (2018, 10 16). Google, Microsoft, Mozilla And Others Team Up To Launch WebAssembly, A New Binary Format For The Web. Retrieved from TechCrunch:
https://techcrunch.com/20(...)he-web/?guccounter=1Wikipedia. (2018, 10 16). Retrieved from Wikipedia:
https://commons.wikimedia(...)gator-usage-data.svgWikipedia. (2018, 10 16). Ryan Dahl. Retrieved from Wikipedia:
https://en.wikipedia.org/wiki/Ryan_Dahl 5 Figures
Figure 1 Brendan Eich (NNDB, 2018) 5
Figure 2 Netscape Navigator Market share (Wikipedia, Wikipedia, 2018) 6
Figure 3 Selection of Top Five Most Used Programming Languages According to Jetbrains (JetBrains, 2018) 6
Figure 4 Simplified JavaScript equation and initialization of constant grammar. 8
Figure 5 Derivation of previously defined simplified grammar. 8
Срдачан поздрав Flip.
I think that it’s extraordinarily important that we in computer science keep fun in computing
For all who deny the struggle, the triumphant overcome
Met zwijgen kruist men de duivel