npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qcompiler

v2.0.1

Published

A collection of APIs to compile code on a machine.

Downloads

7

Readme

Why qCompiler?

qCompiler offers a user-friendly solution for developers who want to integrate code compilation into their applications. Whether you are building an educational platform, have coding challenges, or need a reliable code compilation service, qCompiler streamlines the process.

Supported Languages

qCompiler is currently in the initial development stage. As the library grows, so does the list here.

| Language | Support | |-----------|:---------:| |C |✔| |C++ | ✔ | |Java | ✔ | |Python | ✔ |

Supported Operating Systems

All the APIs are written for Windows and Linux operating systems. But, till now we have tested only for the Windows operating system. Soon we will test all the APIs for the Linux operating system also.

Workflow

  1. Receive Code and Input Data: Get the program and input data from the client as requested.

  2. Compile the Program: Utilize the qCompiler module to compile the program.

  3. Retrieve Output and Errors: Obtain the output and errors in JSON and string formats.

  4. Respond to the Client: Send the output back to the client.

Setting Up Compilers

Before utilizing qCompiler, ensure that the necessary compilers for the target programming languages are set up on the server. Necessary guidelines can be found here.

Getting Started

Installation

To install qCompiler run the following command.

  npm i qcompiler

Define Configuration

Define the basic configurations to compile your program.

const config = {
   standard: "c11",
   cmd: "gcc",
   executionCmd: 'java', //only for java
   timeout: 2000,
}

standard:

You can define any valid standard that supports your machine's compiler. standard is applicable only for C and C++.

Default standard:

| Language | Default Value | |----------|:-------------:| | C | "c11" | | C++ | "c17" |

cmd and executionCmd:

cmd and executionCmd are the commands to compile or run your program.

Default values for cmd for several languages are:

| Language | Default Value | |----------|:-------------:| | C | "gcc" | | C++ | "g++" | | Java | "javac" | | Python | "python" |

executionCmd is necessary for Java only. Default value javac.

// If the environment variable is set
cmd: "command"

// If the environment variable is not set
cmd: "path/to/command/yourCommand" 

// Example
cmd: "C:\MinGW\bin\gcc"

Timeout:

In milliseconds the maximum amount of time the program is allowed to run. Default: 1000ms.

Basic Usage

C

To compile a C program you can use the following template.

const compiler = new QCompiler(config);

const response = await compile.compileC(code, input);

console.log(response)

C

To compile a C++ program you can use the following template.

const compiler = new QCompiler(config);

const response = await compile.compileCpp(code, input);

console.log(response)

Java

To compile a Java program you can use the following template.

const compiler = new QCompiler(config);

const response = await compile.compileJava(code, input);

console.log(response)

Python

To compile a Python program you can use the following template.

const compiler = new QCompiler(config);

const response = await compile.compilePython(code, input);

console.log(response)

Output Format

//  data.status = boolean | string
//  data.output = Output value | undefined
//  data.error  = Error message (if status == false) | undefined
//  executionTime = total execution time in milisecond | undefined

Note

For the most up-to-date information and usage guidelines, please take a look at the official documentation. Explore the power of code compilation with qCompiler – the comprehensive solution for seamless integration and efficient processing.

License

All the contents in this repository are released under the MIT License.