开发者

Is it possible to embedd compiler inside browser

I have in site topcoder.com where we can create and compile code in the browser.

is it possible to code something like that in my browser i can write code in text editor and then i have compile button over there.

Or may be the request is sent to the compiler on server gcc and then get resu开发者_C百科lt from there.

How can i achieve something like that


Your latter (send to server) is exactly what sites like codepad.org do. There are of course security problems with openly allowing people to execute compilers and run programs on your server.

The browser only option could include:

  • NaCl (native client)
  • Writing a compiler in JS (possible, not suggested for sanity depending on language)
  • Using a Java applet and writing a compiler
  • Ditto for Flash
  • Ditto for SIlverlight
  • ActiveX control (not suggested)


Sites like TopCoder have the compiler on a back-end server. The code pasted to the site is sent to back-end server where it is compiled and run and the results returned to the user's browser.


Yes. You can send the codes to your compiler by uploading the code to server, compile it and then send back result / console output to browser screen.

For your information, PHP can execute shell commands (which can "order" your compiler to compile the codes).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜