Skip to content Skip to sidebar Skip to footer

How To Embed Compiler And Interpreters To A Website Like Codecademy?

I got a project to design a website which has a javascript & HTML interpreters, Database, C++ compiler. I have searched related websites and I ended searching with codecademy .

Solution 1:

In very simplified terms, there are two ways to achieve a live interpreter/compiler on a web site:

  1. Find (or write) a compiler/interpreter for your language that is written in Javascript

  2. Create a (native) CGI application and run it on your server that will run a given piece of code through a (native) interpreter/compiler (also on your server) and return the result of the run. Then write a web page that calls on that CGI to do the work, usually using AJAXy Javascript things like xmlHttpRequest, or at least a web form.

That's what all of these sites essentially boil down to. Some just have an interpreter or CGI that can remember state between calls, and can then show you intermediate steps. This could be because your JavaScript-based interpreter supports pausing, or your CGI could e.g. have the program run in lldb and then your page sends certain commands to LLDB and returns information.

Note: If your question was more about how to actually write an interpreter in JavaScript, I detail the basics of parts of an interpreter here: http://orangejuiceliberationfront.com/how-to-write-a-compiler/ It is for C programmers, but the basics hold true in any programming language. You can always use arrays instead of memory blocks, and array indexes instead of memory addresses.

Solution 2:

Simply web application takes our code as input and store in file with respective the programming language extension like .java, .c etc and then they used the server side install compiler to run the code and forward the output to the client through web page.

Suppose in java, there is class Runtime and Process with the help of this class we get the control on server side install software like java, javac etc with that we run the program and transfer the output to User..

It is very simple if any one want code for that then ping me..

Post a Comment for "How To Embed Compiler And Interpreters To A Website Like Codecademy?"