Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Languages that interpret down to Javascript?

Another post questioned how practical it is to compile languages into Javascript. Practicality aside, what interpreters translate from some language X to Javascript and were implemented in Javascript? I'm especially interested in the cases where X wasn't designed with the intention of targeting Javascript. Even if the interpreter isn't totally finished I'd like to hear about it.

You may be curious about the motivation for this question. Javascript certainly can't leverage as much power as assembler, but the flexibility for code distribution and execution may sometimes outweigh that cost.

One use case for these interpreters is a model for teaching and learning programming languages. Consider how useful it is to have a Javascript interpreter in the interactive book Eloquent Javascript. Sure, there may be a performance hit over compiling it natively, but in some situations the cost is certainly worth it. And yes, I realize it's always an option to rely on the server to compile or interpret code, but I'm specifically interested in client-side approaches.


UPDATE: A lot of responses include references to compilers that weren't implemented in Javascript. I just want to stress that the interpreter itself should be implemented in Javascript so that both it and the source language code could run on the browser on your grandparent's computer.

like image 805
Sage Mitchell Avatar asked Dec 11 '10 00:12

Sage Mitchell


People also ask

What languages does JavaScript work with?

Additionally, most major browsers allow JavaScript to compile code during program execution. Versatility ‒ JavaScript is compatible with other languages like PHP, Perl, and Java. It also makes data science and machine learning accessible to developers.

Which language is most like JavaScript?

Typescript This object-oriented programming language is gaining popularity in the front-end development with 80% of developers stating that they would use Typescript in their next project. Microsoft developed this language and it comes as the superset of JavaScript with backward compatibility.

What is JavaScript low level language?

A low-level language means close to the machine. Javascript is not close to the machine in any way shape or form. The best definition for low-level is: "could you write an entire OS kernel it, without any shim between your code and the machine?" If it's yes, you have a low-level language.


2 Answers

CoffeeScript is a programming language that compiles to JavaScript.

like image 119
calvinf Avatar answered Sep 30 '22 18:09

calvinf


  • Objective-J is a language that basically takes the "Objective" part of Objective-C and glues it to ECMAScript
  • Clamato is a Smalltalk-inspired language for client-side web scripting

See also this question: Are there other languages than Objective-J that get “compiled” to JavaScript in the browser?

like image 21
Jörg W Mittag Avatar answered Sep 30 '22 20:09

Jörg W Mittag