Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Client-side Web REPL For 15+ Languages

Unknown Lamer posted about 3 years ago | from the symbolics-wants-your-brains dept.

Programming 38

In his first accepted submission, MaxShaw writes " is an online REPL that supports running code in 15+ languages, from Ruby to Scheme to QBasic, in the browser. It is intended as a tool for learning new languages and experimenting with code on the go. All the code is open sourced under the MIT license and available from GitHub." A few of the languages are supported by reusing existing "Foolang in Javascript" interpreters, but a number of them are built using Emscripten (previously used to build Doom for the browser). All evaluation occurs client side, but saved sessions are stored on their server.

cancel ×


Sorry! There are no comments related to the filter you selected.

Why not C (0)

Anonymous Coward | about 3 years ago | (#37461556)

They could emulate C, then run pretty much every language, considering most are written in (or have an implementation in) C.

Re:Why not C (2)

fusiongyro (55524) | about 3 years ago | (#37461896)

Emulate a low-level machine in your high level language, and use that emulated low-level language to implement another high level language. That's going to be a real performer.

Re:Why not C (0)

Anonymous Coward | about 3 years ago | (#37462084)

Nevermind that. Every C program I've ever written beyond simple demos had to load or link libraries. Unless there's a linker in the browser (or they implemented some kind of dynamic library loading which would be horribly insecure) then it can't do serious C. Of course that's not what it's for. I'm just saying...

Re:Why not C (1)

Lennie (16154) | about 3 years ago | (#37462106)

Actually, in the early days libraries did not exist, that is why the X Window System has the architecture it does.

Re:Why not C (2)

MaxShaw (1151993) | about 3 years ago | (#37462140)

A few notes on this. We're using Emscripten to compile interpreters written in C to LLVM bytecode then to JavaScript. Emscripten supports both static and dynamic library loading by compiling the libraries to JavaScript. The Python standard library on, for example, loads dynamic libraries, so it's definitely doable. Performance is of course not amazing, but for a REPL, it's certainly good enough.

Almost full circle (1)

discord5 (798235) | about 3 years ago | (#37461562)

Now we just need someone to code a browser in that thing, and we're ready for web 3.0

RELP (4, Informative)

JonySuede (1908576) | about 3 years ago | (#37461596)

for those who don't remember their lisp class : (define REPL 'Read-Eval-Print Loop')

Re:RELP (1)

Jmc23 (2353706) | about 3 years ago | (#37461910)

I wonder if you're trying to be ironic.

Re:RELP (1)

JonySuede (1908576) | about 3 years ago | (#37462018)

call that informative irony

Re:RELP (0)

Anonymous Coward | about 3 years ago | (#37464418)

We call that a "shell" normally.

Re:RELP (0)

Anonymous Coward | about 3 years ago | (#37464720)

"Interpreter" would be more common. The reason lispers don't call it an interpreter is that the Eval stage in REPL is often implemented by calling a compiler.

Re:RELP (1)

Kyont (145761) | about 3 years ago | (#37467408)

Ruh roh, Raggy, something's wrong in your Rubject line!

Foolang (0)

Anonymous Coward | about 3 years ago | (#37461726)

A few of the languages are supported by reusing existing "Foolang in Javascript" interpreters...

I've never heard of "foolang". Is it any good?

Re:Foolang (0)

Anonymous Coward | about 3 years ago | (#37463280)

The good part is going to the foobar after a long day coding in foolang.

Re:Foolang (0)

Anonymous Coward | about 3 years ago | (#37463408)

Do you get a foobuzz after that?

Re:Foolang (1)

mzs (595629) | about 3 years ago | (#37471680)

Nope, you get a foobaz instead.

Re:Foolang (1)

syousef (465911) | about 3 years ago | (#37465440)

A few of the languages are supported by reusing existing "Foolang in Javascript" interpreters...

I've never heard of "foolang". Is it any good?

Foolang me once, shame on you. Foolang me twice, shame on me!!!

tried the qbasic interpreter (1)

wierd_w (1375923) | about 3 years ago | (#37461822)

Total fail.

Balks on something as simple as:


Further, requires all commands to be in all caps, while real qbasic doesn't give a squat.

Attempted a builtin graphics function, but the interpreter has no idea about how to do the LINE operation.

Kids would be MUCH better off with real qbasic in dosbox.

Re:tried the qbasic interpreter (1)

flimflammer (956759) | about 3 years ago | (#37462878)

I too was disappointed by the complete lack of support in the QBASIC version. It's so primitive that it's barely worth mentioning.

Re:tried the qbasic interpreter (0)

Anonymous Coward | about 3 years ago | (#37463416)

This is because doesn't support COBOL, so the next best thing is to use BASIC with everything IN CAPS.

Re:tried the qbasic interpreter (1)

Mitchell314 (1576581) | about 3 years ago | (#37463978)

qbasic runs in windows too.

I don't really like REPL (2)

moonbender (547943) | about 3 years ago | (#37461886)

Seems like REPLs have gotten more popular recently. I guess I don't really get it, I found a good interactive debugger more useful as a learning tool. Particularly with rich abilities to inspect variables and variable hierarchies. A REPL-like tool as one feature of such an environment is nice to have, sure. But just the REPL on its own seems really limiting.

Re:I don't really like REPL (1)

Anonymous Coward | about 3 years ago | (#37464012)

It depends a lot on the language.

Having a REPL doesn't mean you throw out everything else you already use. What the REPL does is it lets you also do a lot of small, incremental tests/experiments as you're coding, without having to have a program that's fully ready to compile. Once you get used to having that ability, it can really help. I've used it a bit when playing around with various lisps and python, and though I haven't written any really big projects in those, I found it useful to be able to throw a code snippet into an interpreter and immediately interactively mess around with it to prove to myself that it does (or doesn't) work the way I think it does.

The results of doing things that way were that: 1) I learned my way around some things faster than if I'd had to look them up in detail, 2) caught mistakes a lot faster, since I didn't have to finish a large block of code before finding out I had to rewrite it, and sometimes 3) figured out I had to change my approach to a problem much sooner than otherwise.

The best way to do this is, of course, when the REPL is well integrated to the development environment. So that you get useful feedback when you blow it up with a mistake, heh.

Re:I don't really like REPL (0)

Anonymous Coward | about 3 years ago | (#37464782)

All the lisp REPL implementations I have used include debugging facilities.

cool but... (1)

marcello_dl (667940) | about 3 years ago | (#37462374)

... it seems that installing stuff on one's pc is taboo, and that happens now, when A. storage is not a problem B. installation can be done by easy to use app/package repositories C. money is not a problem because tons of free software are around.

Of course the idea makes sense because most people go with the instant gratification of a prompt in a web page and don't really care if their mostly idle cpu has to work more for their hello world.

Very slow (1)

Hentes (2461350) | about 3 years ago | (#37463246)

Is everyone here is using it now?

Re:Very slow (0)

Anonymous Coward | about 3 years ago | (#37464294)

A simple each loop over an array with a few elements is slow as hell in Ruby mode. That's not going anywhere.

For a more extensive language set... (1)

AngryDill (740460) | about 3 years ago | (#37464650)

...try IdeOne [] . Code doesn't run in the browser -- it's compiled and runs server-side -- but it supports dozens of languages, including esoteric ones like intercal and whitespace, and allows you to optionally publish your code snippets, a la pastebin.


possibly filling an important niche (1)

bcrowell (177657) | about 3 years ago | (#37464754)

I'll lay out my specific use case, but basically the question is this: who's going to come up with a decent browser-based environment for people to use in order to learn how to program?

My use case: I teach physics for a living, and I teach my students to do simple numerical simulations as an alternative to limiting them to the kinds of problems that can be solved in closed form using paper and pencil. These folks are not sophisticated about computer programming, and my goal is not to teach them to program; basically I only expect them to get to the level where they can make modifications to a program in the book so that it can be applied to a different problem.

I use python for this, and currently the best option I've found is to have them use, which is a free-as-in-beer service that runs their code server-side, through a web interface. What sucks about it is that ideone is totally closed source, and if they stop providing their service tomorrow, I'm out of luck.

Up until now, the best alternative I'd found was a REPL for a language called coffeescript: [] . (Click on TRY COFFEESCRIPT.) The language is close enough to python in syntax that it wouldn't be a big deal to me to switch. Performance is very good. The main disadvantage is poor error handling, which is a big deal to beginners.

The system looks nice. (a) It's open-source, so if I hitch my wagon to it, I won't have to switch to something else five years from now. (b) The performance is decent, although not as good as the other two systems I've described above. (c) Error handling seems good (apparently the same error handling as in the standard python implementation, because apparently that's what you're using, through an emulation layer).

Re:possibly filling an important niche (1)

lxs (131946) | about 3 years ago | (#37466242)

Have you tried using spreadsheets to run numerical simulations?
Advantages are built-in graphing capability and no need for the kids to do any programming.
Excel is found on most PCs and if it isn't then Libreoffice is free.

Just because people use them to make shopping lists doesn't mean that they are limited to trivial tasks.

Re:possibly filling an important niche (1)

bcrowell (177657) | about 3 years ago | (#37469388)

Have you tried using spreadsheets to run numerical simulations?

Some people do use spreadsheets for that. This disadvantages IMO are: (1) Spreadsheets can't be easily read by another person. That means I can't present them to the students, and they can't turn in their work to me in a form that I can read. (2) Spreadsheet languages are basically all proprietary. Life is too short to learn proprietary languages. (It's true that, e.g., Excel and OOo are quite similar, but that's not the same as having a real, open standard.)

Really cool! (1)

inglorion_on_the_net (1965514) | about 3 years ago | (#37464852)

This is one of the coolest things I have seen for a long time! I'm really impressed. Congratulations, guys!

Where are my bignums? (0)

Anonymous Coward | about 3 years ago | (#37465420)

The scheme implementation does not implement bignums but rather is using floats. So not a R5RS compliant. I imagine a few other things are like this in other languages, however looks like a great project.

Compile to high language is our future? (1)

sgt scrub (869860) | about 3 years ago | (#37468672)

So we have gone from compiling code to machine language to compiling code to a scripting language so it can be compiled to machine language? That is a neat project; but, I'd be much more impressed if someone came out with a browser vm that actually understood and converted 15+ languages to machine code instead of just javascript. Anyone know of a multi-language vm? Maybe I can write a browser based on it.

Re:Compile to high language is our future? (1)

JonySuede (1908576) | about 3 years ago | (#37475750)

parrot, CLR, and jvm, that's yours mainstream choices

Re:Compile to high language is our future? (1)

sgt scrub (869860) | about 3 years ago | (#37478698)

Yeah. CLR and JVM are single language unless you use something like XMLVM. Parrot is changing the code for embedding it into an application. So, I guess that future project is on hold.

Re:Compile to high language is our future? (1)

JonySuede (1908576) | about 3 years ago | (#37482830)

non CLR, means common language run-time, you have C#, managed C++, F#, IronPython, IronRuby and quite a few other, it is backed by a common type system so the interop is remarkable.

And since jvm 7 with the invokedynamic op-code, dynamic language are supported with decent performance, you should read about jython, jruby and groovy on the dynamic side and to scala on the functional one. The inter op from dynamic to statics hard to do but the reverse is easy.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>