Friday 7 May, 2010

Online compiler/interpreter/IDE


I had been using www.codepad.org whenever I wanted to run a piece of code and didn't have the required compiler/interpreter in the system I was using. But the main disadvantage with this was that you cannot read input from the user while using this site - scanf(), cin, <STDIN>, etc. (in C, C++, Perl respectively) are promptly ignored. This was often an irritation since I'd have to modify my program to not take an input before testing there, which might not be an easy process (especially given complex data structures).

Today, I came across http://ideone.com, which is very similar to the above, except that it allows providing input to the program! Yay! You type (or paste) the program in a text area as in codepad, choose your language from the list, and then click on "click here to paste input (stdin) or additional note". Whatever you type here becomes the input to your program. That's a neat solution to the problem of providing input to remotely-evaluated programs.
And it supports "more than 40 languages", including Assembler, Common Lisp, and even Whitespace (of course the boring old C, C++, Java, Perl, Python, etc. are there too). It has other goodies like syntax highlighting for all these languages, 'private' pasting for times when you don't want others to see the code, etc. The site is quite very well done.

While we're in the topic, let me also add two more online code evaluation tools (compilers/interpreters):

* Lord of the REPLs: This is a Read-Eval-Print-Loop from Google, where each line you enter is evaluated immediately. Despite the fancy "Lord" name and the Google brand, I haven't found this very useful mainly because: it doesn't preserve function definitions or variables' values after you evaluate them, unlike other REPLs. This makes it hard to run anything more than trivial "hello world" programs. Also, I found it quite buggy at times.

* "Compile & Execute": This is somewhat similar to ideone, allowing you to enter your own input and having a choice of a similar number of languages. However, it doesn't have a 'private' pasting option, and has syntax highlighting for only a few languages. This leads to weird highlighting at times: if you choose to paste Perl code, the Highlight choice remains in cpp (which is the default), so your Perl code gets highlighted as C++ code! Sloppy design like this makes me think this site might not be very well designed.

These two are the only generic code evaluation tools I could find. If you find that none of these do it for you, try googling for something specific to your language. For example, for Python, searching for 'python online (IDE OR compiler OR interpreter)' gives a lot of good results.

If you know some other online code evaluation tool, or have experience with any of the above, do share it in the comments. Thanks!


8 comments:

kuszi said...

> "except that it allows providing input to the program!"
Ideone also allows to be used as WebService (through API) and built services such as "Compile & Execute" upon it.

Sundar said...

Thanks kuszi. I had previously missed the "Compilation service proudly provided by IDEONE API SERVICE" in the Compile & Execute page.
That is a good service, might come in very handy for conducting mini-level online coding competitions, requests for solutions as small pieces of code, etc.

Are you, by any chance, part of the Ideone team?

kuszi said...

Thanks for posting about Ideone.

You can contact the Ideone Team through the contact (at) [hostname] e-mail address.

Anonymous said...

If you liked Ideone as it has been so far, you will like the new one even more. The most important new features available for Ideone users are:

* management panel where users can view and group their pastes,
* personalized access to Ideone API
* and public folders which allow to publish and share a group of pastes at one go.

Anonymous said...

Compilr.com seems to be the best online compiler and IDE so far.

Yuri Gonzaga said...

IMHO, SourceLiar (http://www.sourcelair.com/) is a good choice too.

Jayk said...

How about this online java debugger WhizCoder which has both compiler and debugger for java language

Anonymous said...

I prefer http://onlinegdb.com because it has compiler and debugger both.