# marmot play (/docs/commands/play)

<!-- Generated by scripts/gen.mjs from `marmot play --help` and scripts/commands.mjs. Do not edit by hand. -->

Serve a page on this machine with an editor for a Go program (the sample, or main.go of dir). Run shows the program's output and exit status. The page also shows the program at each stage of the compiler: x/tools SSA, MLIR with the go dialect, LLVM IR and machine code. Each stage is shown for dev, -O 2 or -release builds. Each line is tied to its source line, and the binary's size is shown by package. Compiler messages show in the editor. Programs run unconfined with a timeout, so the server listens on the loopback only. -service serves only the compile API. -json compiles one program and prints the API's reply instead. The reply has each stage's text, the source line of each text line, and the stage lines that each source line (file:line) became.

```text title="Usage"
marmot play [dir] [flags]
```

## Examples [#examples]

```sh
marmot play
marmot play -open ./cmd/demo
marmot play -json -mode O2 sum.go
```

`marmot play` serves the page of [/play](/play) on this machine. The page shows the program at each
stage: Go SSA, MLIR with the go dialect, LLVM IR and machine code.

**Warning:** Run executes the program on your machine, with a timeout and no sandbox. Keep the server on the loopback address.

## Flags [#flags]

Flags take one dash or two: `-release` and `--release` are the same.

| Flag | Meaning |
| --- | --- |
| `-addr string` | address to serve on (keep it on the loopback: programs run unconfined) (default "127.0.0.1:7375") |
| `-allow-origin string` | with -service: the Access-Control-Allow-Origin of /compile |
| `-json` | do not serve: compile the file (or the .go files of the directory) once and print the compile service's JSON reply, stages and line maps included |
| `-mode string` | with -json: dev, O2 or release (default "O2") |
| `-open` | open the page in the browser |
| `-service` | serve only the compile API (POST /compile, GET /healthz): no page, programs are never run |
| `-stages string` | with -json: the stages, comma separated (default "ssa,mlir,llvm,asm,size") |

## Full help [#full-help]

```text title="marmot play --help"
Serve a page on this machine with an editor for a Go program (the sample, or main.go of dir). Run shows the program's output and exit status. The page also shows the program at each stage of the compiler: x/tools SSA, MLIR with the go dialect, LLVM IR and machine code. Each stage is shown for dev, -O 2 or -release builds. Each line is tied to its source line, and the binary's size is shown by package. Compiler messages show in the editor. Programs run unconfined with a timeout, so the server listens on the loopback only. -service serves only the compile API. -json compiles one program and prints the API's reply instead. The reply has each stage's text, the source line of each text line, and the stage lines that each source line (file:line) became.

Usage:
  marmot play [dir] [flags]

Examples:
marmot play
marmot play -open ./cmd/demo
marmot play -json -mode O2 sum.go

Flags:
      --addr string           address to serve on (keep it on the loopback: programs run unconfined) (default "127.0.0.1:7375")
      --allow-origin string   with -service: the Access-Control-Allow-Origin of /compile
  -h, --help                  help for play
      --json                  do not serve: compile the file (or the .go files of the directory) once and print the compile service's JSON reply, stages and line maps included
      --mode string           with -json: dev, O2 or release (default "O2")
      --open                  open the page in the browser
      --service               serve only the compile API (POST /compile, GET /healthz): no page, programs are never run
      --stages string         with -json: the stages, comma separated (default "ssa,mlir,llvm,asm,size")
```