⬆️ ⬇️

js2js: compiler from javascript to javascript

JavaScript is a web assembler. There are dozens of projects in the world that compile code in C ++, Java, C #, Python, Ruby, or any other language in JavaScript. Virtually no language remains that cannot be compiled into JavaScript. Well, except maybe ... JavaScript itself!

image

We decided to correct this situation. Meet: js2js is a revolutionary compiler that compiles javascript to javascript!



Key features of the project



Control : you get full control over each line of the resulting code. You can even compile a non-working JavaScript program into an identical non-working program.

Zero overhead projector: js2js will not slow down the execution of the code, the compiled code will have exactly the same performance as the original one.

Integration : js2js works with any other existing JavaScript-related technology: AngularJS, Emscripten, Vanilla JS, jQuery, CoffeeScript, TypeScript, and even Dart.

Compatibility : the code generated by js2js supports all types of fixed, mobile devices and browsers. Even if you are writing under Netscape 2.0, you can compile your code in js2js.



Using



The project code is available on github and works on NodeJS. In order to compile your code just enter the following command in the console:

node js2.js -i <input_file_or_directory> -o <output_file_or_directory> 


For example, you can compile the compiler itself:

 >node js2.js -i js2.js -o js2.compiled.js -v Welcome to js2js compiler. Compiling js2.js... Output is written to: js2.compiled.js Done! 




How can I help the project?



The project code is available under the MIT license, which means you can send your pull-requests, develop your project branch, use it in your commercial and not-so projects, or just tell your friends about it.


')

Source: https://habr.com/ru/post/201980/



All Articles