Javascript Preprocessors
Some compilers have a precompile or preprocessor to process statements, that are not part of the computer programming language. The preprocessor is the first to look at the source code file and performs several preprocessing operations before it's compiled by the compiler.
In computer languages such as C there is a phase of translation known as preprocessing. The amount and kind of processing done depends on the nature of the preprocessor. Some preprocessors are only capable of performing relatively simple textual substitutions and macro expansions, while others have the power of full-fledged programming languages.
No Preprocessor specifically designed for JavaScript. Lexical (Language) preprocessors are flexible, which means, they are preprocessors with lexical analysis rules, that can be customized and can used with JavaScript. It is advisable to use preprocessors that have been designed for a language having a similar syntax as JavaScript.
Let us now explore the Google Chrome development tool, also
called Chrome DevTools, which has JavaScript preprocessing features.
Chrome DevTools
Chrome DevTools is in-built with Google Chrome browser. The Chrome DevTools JavaScript preprocessor captures JavaScript before compilation and allows JavaScript to be trans-coded. The preprocessor facilitates and artificial runtime be constructed in JavaScript.
JavaScript work well with browser, various compilers used to convert JavaScript
Supported Preprocessors and Trans compilers are:
- CoffeScript Language and Compiler: to compile CoffeeScript code into JavaScript, install CoffeeScript package using npm coffeescript. Npm is the default package manager for JavaScript runtime environment Node.Js.
- TypeScript Language and Compiler: superset of JavaScript and more suitable for large scale development. Better feature as compared to JavaScript. More important features are:
·
Built on JavaScript
·
Library Support
·
JS and TS are equivalent
·
TypeScript is light
·
TypeScript aligns with
ECMAScript provisions
- Dart or CoffeeShop need a language specific environment where TypeScript has no such requirement. As it is JavaScript based.
- Duck Typing: when an object is passed through a combination of properties and methods to determine its semantics and belongings, it is known as duck-typing. TypeScript uses duck-typing to define structure that are complex.
- Traceur.js is a JavaScript compiler by google. It is not only easy to utilize but also excludes the complications with massive build system. ES modules can load easily when Traceur incorporated in a page.
ES6 module?
Babel is open source JavaScript compiler and used for web development. Software developer can write source code in a preferred markup language or programming language, they need babel as source-to-source compiler to translate into JavaScript so modern web browser can read it.
·
Transform syntax
·
Source code transformations
Comments
Post a Comment