Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 1.01 KB

README.md

File metadata and controls

64 lines (50 loc) · 1.01 KB

OneCompiler

Compilation of many languages in Python!


Mini documentation

Installing the library

> pip install onecompiler

Import

from onecompiler import Compiler	# Sync
from onecompiler import AsyncCompiler	# Async

Initialization

compiler = Compiler()

Get a list of available languages

print( compiler.all_languages )

Languages are compiled through the Compiler attribute or using compiler.to.lang
» For query languages compiler.query.lang

Example

# Sample JavaScript code
res = compiler.to.js('console.log("Hello");')
print(res.stdout)
# Hello

# Sample MySQL code
res2 = compiler.query.mysql('SELECT 10')
print(res2.stdout)
# 10

Or

res = compiler.compile(lang='js', code='console.log("Hello");')
print(res.stdout)
# Hello

res2 = compiler.compile(lang='mysql', code='SELECT 10')
print(res2.stdout)
# 10