ezcompilex
v0.7.4
Published
It is a node.js library which is written on top of compilex to run code on Linux
Downloads
8
Maintainers
Readme
compilex is a node.js library which is used to build online code compiler/interpreter websites and webservices.
You can compile and respond back outputs for all the languages that can be compiled by the server.
Some of the online code compiling/judging websites are
Why compilex ?
- compilex can detect infinite loops in the users program .
- It can compile programs by getting input from STDIN.
- Generates statistics for the administrator.
Supported Languages
compilex is currently in initial development stage . As the library grows , so does the list here .
| Language | Support | |---------|:-------:| |C |✔| |C++ | ✔ | |Java | ✔ | |Python | ✔ | |C# | ✔ | |Visual Basic | ✔ |
Work Flow
- Get the program as input from the client as a request
- Use compilex modules to compile the program
- Get the output and errors in json and string formats
- Respond the output to the client
Setting Up Compilers
Inorder to compile any programming language , you need to first have the compiler for that programming language in the server machine.
NOTE : Video demos for setting up the compilers and using compilex will be availble soon.
Documentation
//res is the response object
<h5>3)C and C++ with inputs </h5>
```javascript
//if windows
var envData = { OS : "windows" , cmd : "g++"}; // (uses g++ command to compile )
//else
var envData = { OS : "linux" , cmd : "gcc" }; // ( uses gcc command to compile )
compiler.compileCPPWithInput(envData , code , input , function (data) {
res.send(data);
});
var envData = { OS : "windows"};
//mono modules for linux is not included till now
compiler.compileCSWithInput( envData , code , input , function(data){
res.send(data);
});
<h5>10)Visual Basic</h5>
```javascript
var envData = { OS : "windows"};
compiler.compileVB( envData , code , function(data){
res.send(data);
});
var envData = { OS : "windows"};
compiler.compileVBWithInput( envData , code , input , function(data){
res.send(data);
});
<h5>12)Memory Management </h5>
All the temporary files ( source code and executables ) are created in your temp directory.
flush and flushSync helps you to free the memory by deleting the temporary files.
```javascript
compiler.flush(function(){
console.log('All temporary files flushed !');
});
Synchronous version of flush
compiler.flushSync();