Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to run CoffeeScript natively in Terminal?

Since we can run JavaScript using various interpreters, like V8 or Rhino, I thought there should be a way to run CoffeeScript code inside a terminal as well.

Technically, I can do that by using Node.js while running javascript, but I'm curious if there is a standalone interpreter specifically designed for CoffeeScript.

like image 269
NoobDev4iPhone Avatar asked Nov 28 '22 09:11

NoobDev4iPhone


2 Answers

No. You can launch a coffeescript file with coffee filename, but this will just compile the coffeescript file in-RAM and run it as javascript. Well, actually someone did write an interpreter for coffeescript, but that interpreter is written in javascript or coffeescript or so and therefore has to run inside of a JS engine, too. Also, it's slow as hell because it's an interpreter and not a JIT compiler.

As I said, just use the coffee command.

like image 26
thejh Avatar answered Dec 07 '22 01:12

thejh


What's wrong with simply installing and running the interpreter that comes with CoffeeScript itself?

Read the installation part of the guide here: http://jashkenas.github.com/coffee-script/#installation

And then use it like this:

enter image description here

Or am I missing some dimension of your question?

like image 174
Jakob Avatar answered Dec 07 '22 01:12

Jakob