Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tianyishi2001/panlang
Run any code in Node.js
https://github.com/tianyishi2001/panlang
Last synced: about 1 month ago
JSON representation
Run any code in Node.js
- Host: GitHub
- URL: https://github.com/tianyishi2001/panlang
- Owner: TianyiShi2001
- Created: 2020-04-10T11:16:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:06:07.000Z (almost 2 years ago)
- Last Synced: 2024-10-09T13:19:29.919Z (about 1 month ago)
- Language: TypeScript
- Size: 567 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# panlang
Run any code in Node.js
## Demo
```js
import { Engines } from "panlang";
``````js
const { ruby } = Engines.ruby;
const { python } = Engines.python;
const { scala } = Engines.scala;
const { sh, bash, csh, dash, ksh, tcsh, zsh } = Engines.shell;
ruby("puts 'hello from ruby!'")
.then((res) => console.log(res.output))
.catch((res) => console.error(res.error));
python("print('hello from python!')")
.then((res) => console.log(res.output))
.catch((res) => console.error(res.error));
bash("echo hello from bash!")
.then((res) => console.log(res.output))
.catch((res) => console.error(res.error));
scala('println("hello from scala!")')
.then((res) => console.log(res.output))
.catch((res) => console.error(res.error));
``````
hello from bash!
hello from python!
hello from ruby!
hello from scala!
```Compiled languages? Alternative compilers? No problem!
```js
const { clang, gcc } = Engines.c;
const { go } = Engines.go;const c_hello = `\
#include
int main() {
// printf() displays the string inside quotation
printf("hello from c ");
return 0;
}
`;gcc(c_hello)
.then((res) => console.log(res.output + 'via gcc!'))
.catch((res) => console.error(res.error));
clang(c_hello)
.then((res) => console.log(res.output + 'via clang!'))
.catch((res) => console.error(res.error));
go();const go_hello = `\
package main
import "fmt"
func main() {
fmt.Println("hello from go!")
}
`;go(go_hello)
.then((res) => console.log(res.output))
.catch((res) => console.error(res.error));
``````
hello from c via gcc!
hello from c via clang!
hello from go!
```