Slashdot Mirror


Client-side Web REPL For 15+ Languages

In his first accepted submission, MaxShaw writes "repl.it 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.

38 comments

  1. Why not C by Anonymous Coward · · Score: 0

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

    1. Re:Why not C by fusiongyro · · Score: 2

      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.

    2. Re:Why not C by Anonymous Coward · · Score: 0

      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...

    3. Re:Why not C by Lennie · · Score: 1

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

      --
      New things are always on the horizon
    4. Re:Why not C by MaxShaw · · Score: 2

      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 repl.it, 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.

  2. Almost full circle by discord5 · · Score: 1

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

  3. RELP by JonySuede · · Score: 4, Informative

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

    --
    Jehovah be praised, Oracle was not selected
    1. Re:RELP by Jmc23 · · Score: 1

      I wonder if you're trying to be ironic.

      --
      Don't complain about syntax, grammar, or spelling. There is no.hell like input on android.
    2. Re:RELP by JonySuede · · Score: 1

      call that informative irony

      --
      Jehovah be praised, Oracle was not selected
    3. Re:RELP by Anonymous Coward · · Score: 0

      We call that a "shell" normally.

    4. Re:RELP by Anonymous Coward · · Score: 0

      "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.

    5. Re:RELP by Kyont · · Score: 1

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

      --
      You shall see a cow on the roof of a cotton house.
  4. Foolang by Anonymous Coward · · Score: 0

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

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

    1. Re:Foolang by Anonymous Coward · · Score: 0

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

    2. Re:Foolang by Anonymous Coward · · Score: 0

      Do you get a foobuzz after that?

    3. Re:Foolang by syousef · · Score: 1

      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!!!

      --
      These posts express my own personal views, not those of my employer
    4. Re:Foolang by mzs · · Score: 1

      Nope, you get a foobaz instead.

  5. tried the qbasic interpreter by wierd_w · · Score: 1

    Total fail.

    Balks on something as simple as:

    DIM Foo AS INTEGER

    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.

    1. Re:tried the qbasic interpreter by flimflammer · · Score: 1

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

    2. Re:tried the qbasic interpreter by Anonymous Coward · · Score: 0

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

    3. Re:tried the qbasic interpreter by Mitchell314 · · Score: 1

      qbasic runs in windows too.

      --
      I read TFA and all I got was this lousy cookie
  6. I don't really like REPL by moonbender · · Score: 2

    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.

    --
    Switch back to Slashdot's D1 system.
    1. Re:I don't really like REPL by leighklotz · · Score: 1
    2. Re:I don't really like REPL by Anonymous Coward · · Score: 1

      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.

    3. Re:I don't really like REPL by Anonymous Coward · · Score: 0

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

  7. cool but... by marcello_dl · · Score: 1

    ... 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.

    --
    ---- MISSING MISCELLANEOUS DATA SEGMENT --- [sigdash] trolololol
  8. Very slow by Hentes · · Score: 1

    Is everyone here is using it now?

    1. Re:Very slow by Anonymous Coward · · Score: 0

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

  9. For a more extensive language set... by AngryDill · · Score: 1

    ...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.

    -a.d.-

    --


    I'm Erwin Schrodinger and I approve of this message, and I do not approve of this message!
  10. possibly filling an important niche by bcrowell · · Score: 1

    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 ideone.com, 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: http://jashkenas.github.com/coffee-script/ . (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 repl.it 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).

    1. Re:possibly filling an important niche by lxs · · Score: 1

      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.

    2. Re:possibly filling an important niche by bcrowell · · Score: 1

      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.)

  11. Really cool! by inglorion_on_the_net · · Score: 1

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

    --
    Please correct me if I got my facts wrong.
  12. Where are my bignums? by Anonymous Coward · · Score: 0

    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.

  13. Compile to high language is our future? by sgt+scrub · · Score: 1

    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.

    --
    Having to work for a living is the root of all evil.
    1. Re:Compile to high language is our future? by JonySuede · · Score: 1

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

      --
      Jehovah be praised, Oracle was not selected
    2. Re:Compile to high language is our future? by sgt+scrub · · Score: 1

      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.

      --
      Having to work for a living is the root of all evil.
    3. Re:Compile to high language is our future? by JonySuede · · Score: 1

      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.

      --
      Jehovah be praised, Oracle was not selected