gkz / LiveScript

LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
http://livescript.net
MIT License
2.31k stars 156 forks source link

How to start repl during runtime? #1092

Closed anhnhoktvn closed 4 years ago

anhnhoktvn commented 4 years ago

How do I start new REPL session by code during runtime?

ceremcem commented 4 years ago

In browser or in a server side script?

rhendric commented 4 years ago

The LiveScript programmatic API is documented here (scroll past the CLI sections). In Node.js or in the browser, it's pretty easy to build a simple REPL from that API, and this is what the livescript.net website does.

The REPL that you get when you run lsc is not publicly exposed; its implementation is coupled to the Node.js REPL module and several other bits of Node.js functionality, and its interface is not stable. You can technically figure out how to run it in Node.js by reading the LiveScript code, but I wouldn't advise it. You probably can't run it in the browser, at least without doing some fussy module shimming.