Try Python, Ruby, Lua, Scheme, QBasic, Forth ...
repl.it
repl.it
I selected QBasic then changed my mind but couldn't immediately figure out how to get back to the list of the languages. Clicking the logo of a website usually takes you back to the 'home page', which in this case I consider to be the list of languages. You have buttons at the top right, with the lambda taking me back to the language chooser. Maybe button labels, even tooltips would help. But I would definitely make the logo the 'home' button. Even refreshing the page didn't take me back.
Anyway, a minor complaint. A super-cool effort. I will now go play with it some more.
Cool app!
> import subprocess
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/python2.7/subprocess.py", line 429, in <module>
import select
ImportError: No module named select
Also: > os.name
=> 'posix'
> os.uname()
=> ('Emscripten', 'emscripten', '1.0', '#1', 'x86-JS')
> os.environ
=> {'LANG': 'en_US.UTF-8', 'PYTHONHOME': '/:/', 'PWD': '/',
'USER': 'root', 'HOME': '/', 'PATH': '/', '_': './this.program'}
> os.getcwd()
=> '/sandbox'
> os.chdir('/')
> os.getcwd()
=> '/'
> os.popen2('ls -l')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/lib/python2.7/os.py", line 667, in popen2
import subprocess
File "/lib/python2.7/subprocess.py", line 429, in <module>
import select
ImportError: No module named select
> os.popen('ls -l')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 24] Too many open files
* I liked the 'x86-JS' as the architecture.* I know about os.listdir() but I wanted the permissions.
* I automatically did a ^W to delete a word and closed the tab. I don't feel like opening it again or I would probably have more.
* I realize that since this is a CPython -> JS converter that the REPL is running in my browser and no on a server (AFAIK) so it's not like this attempting to hack someone's server, but I found it interesting to probe the environment.
* The ^W is fixable, but I'm not sure how I personally feel about hijacking fundamental browser shortcuts. We'll look into it though.
* Regarding the environment, in general, multi-threading and multi-processing (and anything that depends on them) are not supported, since Emscripten translates the code to JS rather than emulating a machine.
* The Emscripten virtual filesystem has a simple single-user permission model and the libc functions for accessing/modifying the permissions are supported. So technically you could get the permissions through os.access. Not as convenient as ls, of course, but doable.
Good and nostalgic memories of Programming with the Basic.
:)
Importing urllib hangs zlib imports, but the compress and compressobj methods fail
> import zlib
> zlib.compress("askldas")
Internal error: ReferenceError: _deflateInit_ is not defined
One comment: in python, technically tabs are equivalent to 8 spaces, but in your REPL it is equivalent to 4 spaces. Is that a modification to the version of python you are using, or did you make a decision to match 4 spaces (BTW: I really like this, but it breaks some older code)
Style Guide: http://www.python.org/dev/peps/pep-0008/ Indentation Myths: http://www.secnetix.de/olli/Python/block_indentation.hawk
Check http://ideone.com/VIwf4 for an example. Basically, it shows that python treats 8 spaces at the same indent level as a tab
Also, at the moment something like this doesn't work at all (Python):
while True:
user_input = raw_input()
if user_input is 'q':
break
else:
print user_inputError 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
Firefox 6.02 I get:
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
[1] http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler...
Without functions, you really don't have very much of the Haskell language available. It's a partial repl with a fraction of the language at best.
$ ghci
Prelude> let fact x = if x == 0 then 1 else x * fact (x - 1)
Prelude> fact 6
720The webpage at http://repl.it/ might be temporarily down or it may have moved permanently to a new web address. Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
:(
I will have a lot of fun either with the app itself or the source code. Thanks!
If you're still following this thread, amasad and max99x, I have a simple question: how many hours did you two put into this?
Anyways, the real question is "how much did it cost?": $1600+ in sushi dinners! :)
EDIT: I take that back. Lua runs, Python and Ruby do not.
The lack of line numbers was a bit confusing too - my first inclination when seeing a BASIC prompt is to type
10 PRINT "hello"
20 GOTO 10
Aside from that, it seems to work as expected (at least in the quick tests I tried). 10: PRINT "hello"
GOTO 10
This works though: label: PRINT "hello"
GOTO label SCREEN 13
CIRCLE (4, 3), 4, 4
and all the other stuff I used to have fun with years ago will actually work.http://joel.franusic.com/w/page/26128430/Online-REPs-and-REP...
Lua and Scheme work fine. Also, good job on allowing me to close the tab after I managed to get QBasic locked in an infinite loop. :-) (Dual-core likely helped.)
Firefox 7.0, x86 (32-bit), running on Ubuntu 11.04, x86-64.
And ya, we try to sandbox most of our languages inside a Web Worker, which leaves the main thread intact incase of infinite loops and such.