# Interactive REPL

> Start Elide's REPL with `elide repl` to evaluate JavaScript, TypeScript, Python and WebAssembly interactively and share values between languages.

The REPL evaluates code line by line and shares values between languages.

```bash
elide repl
```

`elide` with no arguments in a terminal also starts it. Languages: JavaScript, TypeScript, Python and WebAssembly.

<img src="https://elide.help/assets/demos/repl.gif" alt="One REPL session — JavaScript values used from Python" width="1107" height="691" loading="lazy" decoding="async" class="rounded-lg border border-border my-6 w-full" />

## Commands

| Command | Effect |
| --- | --- |
| `/js`, `/ts`, `/py`, `/wasm` | Switch language. With an argument, evaluate it once in that language. |
| `/lang NAME` | Switch language. |
| `/export NAME` | Share a value with the other languages. |
| `/import NAME` | Bind a shared value in the current language. |
| `/history [N]` | Show recent entries. |
| `/reset` | Delete saved history. |
| `/clear` | Clear the screen. |
| `/help` | List commands. |
| `/exit` | Leave the REPL. |

## Share values

```text
const x = 41
/export x
/py
/import x
print(x + 1)
```

```text
42
```

Sharing works without `--interop`.

## Tern notebook sessions

With the Tern plugin installed and its embedded SDK configured, choose **Open REPL**
from the command palette. Use the language picker or **Ctrl+L** to switch languages.
**Enter** evaluates a cell; **Shift+Enter** inserts a newline.

Each session is one notebook. JavaScript and Python share live values automatically:
enter `const y = {"hi": 5}` in JavaScript, switch to Python, and enter `y.hi` to
get `5`. Changes to the shared object remain visible in both languages.

Declarations produce no result block. Objects appear as expandable JSON trees,
and language headings appear when the cell language changes. Switching preserves
each language's draft and history.

The picker shows languages supported by the configured SDK. CEL evaluates shared
data snapshots. Pkl evaluates modules and makes the result available as `_`.
Kotlin accepts module declarations. TypeScript and WebAssembly execution adapters
are not yet available in the embedded notebook.

### Serving in Tern

The Tern plugin also provides **Serve directory or script**. Enter a directory to
serve static files on an available loopback port, or a script to launch with the
configured runtime. Each server runs independently of notebook kernels.

The native dashboard shows the actual bound URL, readiness, uptime, observed
requests and bounded logs. Click a request for structured status and timing
details; use **Stop** or **Restart** to control the server. Closing the dashboard
stops its server. JavaScript servers using `Elide.serve` provide bind and request
events; server APIs without that instrumentation currently provide logs and
process controls only. A trace waterfall and OTLP inspection are not yet available.
