First App
Create, run, and compile your first Tish application.
Create a Tish file
Create main.tish:
fn greet(name) {
return `Hello, ${name}!`
}
console.log(greet("Universe"))Run with the interpreter
tish run main.tishOutput: Hello, World!
To try code interactively with multi-line input, tab completion, and history, use the Interactive REPL: run tish with no arguments in a normal terminal (stdin is a TTY).
Run from stdin
You can pipe a program instead of using a file (like node - or bun with a pipe):
echo 'console.log("Its")' | tish
echo 'console.log("a small")' | tish run -
echo 'console.log("universe")' | tish -When stdin is not a terminal, bare tish reads the full script from stdin and runs it once. See Installation for the full table of variants.
Compile to native binary
tish build main.tish -o wasup
./wasupSame output. The compiled binary has no runtime dependency on Tish.
For backend options (Rust vs Cranelift), see Native Backend. For WebAssembly (browser or Wasmtime), see WASM Targets.
HTTP server (requires http feature)
Create server.tish:
fn handleRequest(req) {
return { status: 200, body: `Hello, ${req.path}` }
}
serve(8080, handleRequest)Run (the tish binary must be built with the http feature):
cargo run -p tishlang--features http -- run server.tishOr compile to a standalone binary:
tish build server.tish -o server --feature http
./serverThen visit http://localhost:8080/.
Deploy to Zectre Platform
See Deploy Overview for using zectre and the Zectre Platform.