https://github.com/metacall/polyglot-repl
Implements a polyglot REPL which supports multiple languages and shared meta-object protocol scope between REPLs.
https://github.com/metacall/polyglot-repl
metacall multilanguage nodejs polyglot python repl ruby
Last synced: 4 months ago
JSON representation
Implements a polyglot REPL which supports multiple languages and shared meta-object protocol scope between REPLs.
- Host: GitHub
- URL: https://github.com/metacall/polyglot-repl
- Owner: metacall
- License: apache-2.0
- Created: 2021-07-07T00:45:13.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-21T07:28:38.000Z (about 1 year ago)
- Last Synced: 2025-02-21T08:27:45.142Z (about 1 year ago)
- Topics: metacall, multilanguage, nodejs, polyglot, python, repl, ruby
- Language: JavaScript
- Homepage:
- Size: 5.13 MB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [MetaCall](https://github.com/metacall/core/) Polyglot REPL

## Description
This repository implements a Polyglot REPL which shares the state of the meta-object protocol between the REPLs. Using the Polyglot REPL, you can share state between multiple languages through their individual REPL and mix code straight from your terminal.
The high-level `api.js` provided in the `src` provide five functions:
- `initialize`: To initialize the Polyglot REPL
- `select`: To select the individual language REPL; Currently Python (py) and JavaScript (node) are supported.
- `execute`: To execute a line, function or module after a REPL has been selected.
- `destroy`: Destroy the REPL and exit gracefully.
- `available`: Check all the available REPLs.
The `cli.js` provided in the `src` provides a way to develop your own REPLs and execute code straight from the command line. You can sutomize the existing REPL or define a new one.
The entry script `index.js` provides an abstraction over the usage of the high-level APIs defined above through the following commands:
```
%repl : Switch from different REPL (available tags: node py)
%inspect: Show available functions
%available: Show available REPLs
%eval : Load inline code, useful for loading inter-language functions for the REPL
%load ... : Load a file, useful for loading inter-language functions for the REPL
%exit: Finalizes the REPL
```
## Installation
1) Install MetaCall:
```sh
curl -sL https://raw.githubusercontent.com/metacall/install/master/install.sh | sh
```
2) For running it:
```sh
metacall index.js
```
## LICENSE
[Apache 2.0](LICENSE)