A Compiler npm Package.

Overview

vcompiler

npm version

🎉 Version 1.x is live ! 🎉

Introducation


It is the npm package for the compilation of the code. Currently it supports the following programming languages:

1. C language.
2. C++ language.
3. Python language.

It can be used for the compilation of the code with or without the input.


Installation

NPM

npm install --save vcompiler

Yarn

yarn add vcompiler

Initializing the Compiler


const Compiler = require("vcompiler");

// initializing the Compiler instance.
Compiler.init();

Compiling the c or cpp code


  • Without Input

    const Compiler = require("vcompiler");
    Compiler.init();
    const getOutput = async () => {
      try {
        const output = Compiler.compileCppWithInput(
          "cpp",
          `#include <iostream> int main(){ std::cout <<"Hello World"<< std::endl; return 0; }`,
          { OS: "Windows", cmd: "g++" }
        );
        console.log(output);
      } catch (err) {
        console.log(err);
      }
    };

    Output

    Hello World
    
  • With Input

    const Compiler = require("vcompiler");
    Compiler.init();
    const getOutput = async () => {
      try {
        const output = Compiler.compileCppWithInput(
          "cpp",
          `#include <iostream> int main(){ int a; std::cin>>a; std::cout <<"Hello World"<<std::endl<<a << std::endl; return 0; }`,
          { OS: "Windows", cmd: "g++" },
          `1`
        );
        console.log(output);
      } catch (err) {
        console.log(err);
      }
    };

    Output

    Hello World
    1
    

Compiling the python code


  • Without Input

      const Compiler = require("vcompiler")
      Compiler.init()
      const getOutput =  async () => {
            try {
              const output = Compiler.compilerPython("py",`print("Hello World")`, {OS: 'Windows'})console.log(output)
              }
            catch(err){
                console.log(err)
            }
        }

    Output

    Hello World
    
  • With Input

        const Compiler = require("vcompiler")
        Compiler.init()
        const getOutput =  async () => {
            try {
              const output = Compiler.compilerPython("py",`input("Enter the String: ")`, {OS: 'Windows'}, `Hello World!`)console.log(output)
              }
            catch(err){
                console.log(err)
            }
        }

    Output

    Enter the String: Hello World!
    

Pull Request

Please read...

Contribution

Everyone is welcome to contribute to this project and build more functionality into it. Make a fork, improve/fix it and create a pull request. I'd love it! :) Also, I'll be mentioning your names over here!



-By Dev Ankit Choudhary

You might also like...

🛫 TypeScript Starter template to simplify creating your next npm package.

TypeScript Starter Kit This is an opinionated TypeScript Starter kit to help kick-start development of your next npm package. 💡 Get Started Luckily,

Sep 27, 2022

A CLI tool to make Taobao's npm mirror sync your package immediately.

npm-mirror-sync A CLI tool to make Taobao's npm mirror sync your package immediately. 让淘宝的 NPM 镜像立即收录你的包的新版本。 背景 相信国内小伙伴都在用淘宝的 NPM 镜像(npmmirror.com)作为

Jun 9, 2022

🛫 TypeScript Starter template to simplify creating your next npm package.

TypeScript Starter Kit This is an opinionated TypeScript Starter kit to help kick-start development of your next npm package. 💡 Get Started Luckily,

May 19, 2022

My first npm package: all-round-calculatpr

all-round-calculator An npm library package to calculate everything you want. Check out our npm package on npmjs.org. Check out the documentation here

Dec 5, 2022

NPM Package to integrate ONDC into Node.js backend

ondc-node This library can be used to integrate ONDC in JavaScript based applications. Package is developed in TypeScript and will work with Node.Js &

Dec 11, 2022

Repo for tricking NPM into not hoisting your package. No dependencies and a warning if imported.

noist (Short for No Hoist) Repo for tricking NPM into not hoisting your package. No dependencies and a warning if imported. Why? As of npm@7 NPM suppo

Oct 27, 2022

Get exports of an local npm package.

pkg-exports Get exports of an local npm package. Install npm i pkg-exports Usage getExportsRuntime Get the exports by evaluate the module in worker th

Nov 12, 2022

An npm package with Tailwind CSS utility classes for creating responsive grid columns without media queries using auto fit.

Grid Auto Fit for Tailwind CSS A plugin that helps you create a responsive grid layout in Tailwind CSS without using media queries. It uses the auto-f

Dec 28, 2022

Generate link preview using our app, API or our NPM package.

get-link-preview 🔗 View the link preview using our App. Use the API to generate link preview in your app or use the NPM package to use the custom hoo

Dec 21, 2022
Owner
Ankit Choudhary अंकित चौधरी
💻 Full Stack Dev 💻 MERN, MEAN Stack Developer 🎨 UI designer 🎓 Computer Science 📚 Always learning!
Ankit Choudhary अंकित चौधरी
JIT Compiler is a open source online code compiler. You can run more than 40+ most popular programming languages in your browser just-in-time using jitcompiler.

JIT Compiler is a open source online code compiler. You can run more than 40+ most popular programming languages in your browser just-in-time using jitcompiler.

Rajkumar Dusad 36 Jan 5, 2023
npm i uuid, npm i nodemon, npm i commander

goit-nodejs-hw-01 Получаем и выводим весь список контактов в виде таблицы (console.table) node index.js --action list Получаем контакт по id node inde

Oksana Banshchykova 3 Jul 5, 2022
NPM Package that simplifies Auth with Google OAuth2 🔐

Node Google OAuth2 ?? A simple authentication flow for Google OAuth2 Explore the docs » Report Bug Table of Contents About The Project Getting Started

Adarsh C 8 Jun 17, 2022
portfolio-project is a npm package to automatically update your projects section in your portfolio website. It will fetch the selected repositories directly from your GitHub account.

portfolio-project Those days of manually updating portfolio website after every new project made are gone ⚡ Yesss . . . you read that right. ?? portfo

Gaurav Gulati 15 Aug 3, 2021
A NPM package powered by Yeoman that generates a scaffolding boilerplate for back-end workflow with Node.js.

generator-noderplate Generate Node.js starter files with just one command! We have deployed a npm package that will generate a boilerplate for nodejs

Samarjeet 3 Jan 24, 2022
Detect npm packages by author name in your package-lock.json or yarn.lock.

detect-package-by-author Detect npm packages by author name in your package-lock.json or yarn.lock. Install Install with npm: # Not Yet Publish # npm

azu 2 Jan 11, 2022
Source of the cosmwasm npm package

About Cosmwasm.js was created to help new developers get started with their first dApps. It is just a wrapper package to easily import needed features

CosmWasm 36 Dec 28, 2022
Npm package :p

?? poopoo-api Welcome to an "ok" api ⭐ If you like this package, don't forget to star Github package repo here and the website repo here Example code:

frostzzone 2 Mar 18, 2022
A cool npm package.

aditya.utils Colorful Console const a = require('aditya.utils') a.logblue("TEXT") // Blue Text a.logred("TEXT") // Red Text a.loggreen("TEXT") // Gree

AD!TYA 2 Apr 8, 2022
A cool npm package.

aditya.utils Colorful Console const a = require('aditya.utils') a.logblue("TEXT") // Blue Text a.logred("TEXT") // Red Text a.loggreen("TEXT") // Gree

AD!TYA 2 Apr 8, 2022