Exploring Various ECMAScripts

D

DevynCJohnson

Guest
JavaScript is a popular scripting language for web-browsers and other applications. Because of its wide use, many developers have made a variety of variations and dialects of JavaScript. It may benefit some people to be aware of the various dialects and their use as well as how to obtain them.

Before we discuss the various ECMAscripts, it may help to mention JavaScript for comparison. JavaScript is an object-based dynamic duck language that uses the "application/javascript" mimetype and may be in "*.js" files or embedded in HTML code via the "<script>" tags. JavaScript is interpreted by the JavaScript engine of web-browsers; thus, JavaScript is a client-side script. JavaScript is typically interpreted, although some implementations use Just-In-Time Compilation (JIT). Server-side execution uses "Node.JS". Below is a "Hello World" example of JavaScript in HTML5.
Code:
<!DOCTYPE HTML>
<html>
<body>
  <script>
  alert('Hello, World!')
  </script>
</body>
</html>
http://www.w3schools.com/js/
http://learnxinyminutes.com/docs/javascript/

NOTE: A transpiler is a type of compiler that translates code to another form/type of code/programming-language. Transpilation is the process/act of transpiling.

Coffeescript is a simplified form of JavaScript that transpiles to JavaScript. Coffeescript uses "*.coffee" files. To install Coffeescript, run "npm install -g coffee-script" in a terminal. The Coffeescript interpreter is called "coffee". Below is a "Hello World" example of the code.
Code:
alert "Hello World!"
http://coffeescript.org/
http://learnxinyminutes.com/docs/coffeescript/
http://www.linux.org/threads/coffeescript-learn-your-coffee.6249/

synaptic-coffeescript.png


NOTE: UberScript is Coffeescript with type annotations (https://github.com/jstrachan/coffee-script/blob/master/TypeAnnotations.md).

IcedCoffeeScript (ICS) is a dialect of Coffeescript. ICS uses "*.iced" files. The IcedCoffeeScript interpreter is called "iced". IcedCoffeeScript has a lot in common with Coffeescript, obviously since it is a fork of Coffeescript. Many of the interpreter parameters are the same as seen in "coffee". To install IcedCoffeeScript, run "npm install -g iced-coffee-script" in a terminal. The "Hello World" example seen below is the same as the Coffeescript example.
Code:
alert "Hello World!"
http://maxtaco.github.io/coffee-script/

Caffeine is a close dialect and direct fork of Coffeescript. Caffeine uses the same file extension as Coffeescript ("*.coffee"). To install Caffeine, run "npm install -g caffeine" in a terminal. The documentation for Caffeine is the same as Coffeescript.
https://github.com/ich/caffeine

ToffeeScript is a fork of Coffeescript that adds asynchronous grammar. ToffeeScript uses the same file extension as Coffeescript. To install ToffeeScript, run "npm install toffee-script".
https://github.com/jiangmiao/toffee-script

Coco is another dialect of Coffeescript with the purpose of fixing problems in both Coffeescript and JavaScript. Coco files have the "*.co" file extension. To install Coco via a terminal, execute "npm install -g coco". The interpreter is called "coco". Like the other Coffeescript dialects, Coco transpiles to JavaScript.
https://github.com/satyr/coco

LiveScript is a fork of Coco which is a fork of Coffeescript. LiveScript transpiles to JavaScript and uses the "*.ls" file extension. To install LiveScript, execute "npm install -g LiveScript" in a terminal.
http://livescript.net/

Dart is a JavaScript-like language developed by Google that is intended to replace JavaScript. Dart can be transpiled to JavaScript and uses "*.dart" files. The "dart2js" utility (in the command-line) converts Dart to JavaScript. The Dart interpreter is called "Dart Virtual Machine". Below is a "Hello World" example of the code.
Code:
void main() {
  print('Hello World!');
}
https://www.dartlang.org/
http://learnxinyminutes.com/docs/dart/

TypeScript is a JavaScript-like language developed by Microsoft. This language can be transpiled to JavaScript and is in "*.ts" files. TypeScript can be installed by running "npm install -g typescript" in a terminal. TypeScript files can be transpiled to JavaScript in a terminal by running "tsc file.ts". The command will generate a "*.js" file containing the equivalent JavaScript code. Below is a "Hello World" example of the code.
Code:
function greet() {
  return "Hello World!";
}
http://www.typescriptlang.org/

GorillaScript is a form of JavaScript that tries to fix some common problems seen in JavaScript and add new features. GorillaScript transpiles to JavaScript. To install GorillaScript, execute "npm install -g gorillascript" in a terminal. The script files use the "*.gs" extension. To run a script in a terminal, run "gorilla file.gs" and to transpile to JavaScript, execute "gorilla -c file.gs".
http://ckknight.github.io/gorillascript/
https://github.com/ckknight/gorillascript

JSX is a derivative of JavaScript that is statically-typed (rather than dynamic) and is supposedly faster than JS. To install JSX, run "npm install -g jsx". JSX files use the "*.jsx" file extension.
https://github.com/jsx/JSX
http://jsx.github.io/

LispyScript is JavaScript with a Lisp-like macros. LispyScript files use the "*.ls" file extension, and they can be transpiled to JavaScript. To install LispyScript, run "npm install -g lispyscript" in a terminal. Below is an example "Hello World!" code as seen on LispyScript's main website.
Code:
(if (undefined? window)
  (console.log "Hello LispyScript!")
  (alert "Hello LispyScript!"))
http://lispyscript.com/

Pogoscript is a JavaScript-like language that transpiles to JavaScript. This language also offers concurrency. To install Pogoscript, run "npm install -g pogo".
http://pogoscript.org/

NOTE: Support for some of these scripts can be installed via the repos. For instance, Coffeescript can be installed via the repos on many Linux systems.

Further Reading
https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS
http://www.linux.org/threads/javascript-shell-and-more.7252/
 

Attachments

  • slide.jpg
    slide.jpg
    54 KB · Views: 35,635

Staff online

Members online


Latest posts

Top