The Bowen Handbook

Write, run and debug your own programs · Version 1.4

Start on Windows

Extract Bowen-1.3-Windows.zip, enter Bowen-1.3 and double-click Open Bowen Studio.cmd. Leave its terminal open. Studio runs on your PC and opens in your browser. The runner uses Python 3.10 or newer. The launcher looks for a portable engine in the release folder, then for an installed Python. On x64 and ARM64 Windows it offers a one-time portable setup if needed. The handbook also opens directly from disk.

Studio opens numbers.bow. Click Run to see the 35th Fibonacci number and the three largest squares from 1 through 10. Click + New, name a file greet.bow, and enter the two lines below. Click Run, type your name in the Output panel, and press Enter.

ask name
say "Hello, {name}!"

A session with Aya looks like this.

Name? Aya
Hello, Aya!

Programs are plain UTF-8 text. Studio copies the starters into projects the first time it opens. You can edit those copies freely. To open your own directory, run the following from the extracted folder in PowerShell.

.\bowen.cmd studio "D:\Code\My Project"

Try Bowen in a web browser

The Bowen Playground on the Bowen website runs real Bowen on your own device, with nothing to install. Pick an example or type a program and press Run (Ctrl+Enter). Questions from ask appear under the output. Share copies a link containing your program, and your work is saved in the browser automatically. In Chrome or Edge click Install app to give the playground its own window and icon. On an iPhone or iPad use Safari's Share → Add to Home Screen. After the first visit it also works offline. AI extensions and Bowen Studio's debugger need the Windows app.

Install the Bowen app

Double-click Install Bowen App.cmd in the extracted folder. No administrator rights are needed. The installer:

  • adds Bowen Studio to the Start menu and the desktop, and opens it in its own window like any other app;
  • creates Documents\Bowen Projects with the starter programs;
  • gives .bow files the Bowen icon. Double-click one to open it in Studio, or right-click it and choose Run with Bowen;
  • makes the bowen command work in every new terminal, for example bowen run hello.bow;
  • lists Bowen under Settings → Apps, where you can uninstall it. Uninstalling keeps your projects.

To share Bowen, give people the file dist\Bowen-1.4-Windows.zip. They extract it and double-click Install Bowen App.cmd. Bowen needs Python 3.10 or newer. If a PC has none, the installer offers the one-time portable setup.

Add AI in Bowen Studio

Click Extensions in Studio's top bar. Click Install next to Claude or ChatGPT, paste your API key and click Save key. The card then shows Ready. The same window installs any Python package and chooses which AI ✨ Write with AI uses.

Click ✨ Write with AI (or press Ctrl+I) and describe what you want, such as "a quiz that asks three capital cities and keeps score". To change existing code, select it first. Bowen checks the AI's code with its own parser and has the AI fix any errors before inserting it. Read it, then click Run.

Write Bowen in VS Code, with AI help

Bowen also comes as a VS Code extension, so you can use the editor many professionals use, together with AI assistants.

  1. Install VS Code and Python 3.10+.
  2. In VS Code open the Extensions view (Ctrl+Shift+X), click ⋯ at its top and choose Install from VSIX…. Pick dist\bowen-lang-1.4.0.vsix in the extracted folder (or vscode\ inside the installed app's folder). From PowerShell, code --install-extension dist\bowen-lang-1.4.0.vsix does the same.
  3. Open your project folder in VS Code (File → Open Folder). Open any .bow file and press Ctrl+F5 or click ▶ to run it. File → New File… now offers Bowen File next to Python File and Text File.

The extension underlines mistakes when you save, completes names as you type (type . after a value to see its methods), shows help when you hover over a function, and adds snippets such as record, to, for and try. Press Ctrl+Shift+P and type Bowen to see every command, including tests, the debugger and Bowen Studio.

Let AI write Bowen for you. There are two ways, and you can use both.

  1. Write Code with AI (built into Bowen). Set up Claude or ChatGPT once, as described in AI in your programs. Then click the ✨ button above any .bow file, press Ctrl+Alt+I, or right-click and choose Bowen: Write Code with AI. Describe what you want, such as "a quiz that asks three capital cities and keeps score". To change existing code, select it first and describe the change. Bowen sends the language guide with your request, checks the answer with its own parser, and asks the AI to fix any syntax errors, so only code that passes bowen check reaches your file. Review it, then press Ctrl+F5 to run it. The setting bowen.aiProvider chooses Claude or ChatGPT. From a terminal, .\bowen.cmd write "a tip calculator" --out tip.bow does the same.
  2. Your favorite AI coding assistant. Press Ctrl+Shift+X and install Claude Code (Anthropic), Codex (OpenAI's ChatGPT agent) or GitHub Copilot. Then run Bowen: Teach AI Assistants Bowen once per project. It adds CLAUDE.md for Claude Code, AGENTS.md for Codex, and .github/copilot-instructions.md for Copilot. Each assistant reads its file automatically, so its chat, edits and inline suggestions use real Bowen instead of guessing from Python. The same guide is in BOWEN-AI-GUIDE.md.

Bowen compared with Python

Bowen keeps what makes Python easy and removes the ceremony that remains. Everything below runs as written.

TaskPythonBowen
Ask an AI a questionpip install anthropic, an import, a client object, a model name, max_tokens, a list of message dictionaries, then response.content[0].textbowen install claude once, then say claude.ask("Write a haiku")
Turn an email into typed data with AIa Pydantic model or a hand-written JSON schema, then parsing and validationcontact = claude.extract(email, Contact)
Ask for a number, retrying on bad inputa while True loop with try/except ValueError and a range checkask age: int "Age?" between 1 and 120
Top three scores of 70 or moresorted([s for s in scores if s >= 70], reverse=True)[:3]scores where it >= 70 sort by it desc take 3
Remember slow resultsfrom functools import cache then @cachememo to fib(n)
A class with a field and a methodclass, __init__, self.balance = balance, self. on every userecord Account(balance: number = 0) and balance += amount inside methods
Field type checksnone unless you add a libraryrecord Point(x: number, y: number) checks every value
Count in a nested functionnonlocal countcount += 1 just works
Find the best combinationnested loops and manual bookkeepingsolve best with choose, require, maximize
Group and summarizecollections.defaultdict plus loopsrows summarize by it.team {games: count, points: sum it.score}
Save records between runssqlite3, SQL text, commitscollection journal: Session in "app.sqlite"
Testsinstall pytest, write files and functionstest "name" blocks, run with bowen test
Mistyped nameNameError: name 'totl' is not definedUnknown name 'totl'. Did you mean 'total'?
Type hintsdef area(w: float) -> float documents types but never checks themto area(w: number) -> number checks every call
Read JSON from a web addresspip install requests, import requests, requests.get(url).json()web.json(url)
A field that may be missinguser.get("address", {}).get("city")user?.address?.city
Copying a list by accidentb = a shares one list, a classic bugb = a makes an independent value

You can still use every Python library: use python statistics or use python datetime as dt.

Everyday code

Ask a question and branch

ask score: int "Score out of 100?" between 0 and 100
if score >= 90
    say "Excellent!"
else if score >= 70
    say "You passed."
else
    say "Try again."

Type oops or 105 and Bowen asks again. A valid answer arrives as an integer you can use in arithmetic. Supported question types are text (the default), int, number and bool. A yes/no answer becomes a boolean. Omit the quoted prompt for an automatic label, use from ["yes", "later"] to offer choices, or append default 10 to accept a blank answer. Running out of input raises a catchable input_end error.

Indent a block with spaces. Four spaces is conventional and Studio's Tab key inserts four. Align else if and else with their if. Blocks can nest. A colon at the end of an indented header is optional. Blank lines and # comments do not end a block. To make a decision inside an expression, write label = when score >= 70 then "pass" else "retry".

Names, values and arithmetic

a, b = 3, 5
a, b = b, a
point = {x: a, y: b}
point.x += 2
say "x =", point.x
say [10, 20, 30][1:]

Numbers, text, booleans, lists, maps, records, functions, modules and none are values. Maps have text keys. Assign with =. Lists and maps can be updated by index or field. Updates make new values, so saving earlier = point before changing point.x preserves the earlier coordinates. Assignments can also unpack one list or distribute several expressions to equally many names. Bowen evaluates all right-hand values before rebinding any names.

Names created with = inside a branch remain available to the enclosing function or file if that branch ran. Each function call has its own assignments. A function can read enclosing names. Use the inherited explicit set x = ... form to change an existing enclosing binding. A loop counter is local to its iteration. Names are case-sensitive and may contain ASCII letters, digits and underscores with a letter or underscore first.

OperationBowen
Arithmetic+, -, *, /, floor division //, remainder %, power **
Update an existing value+=, -=, *=, /=, %=
Compare==, !=, <, <=, >, >=, in
Combine booleansnot, and, or. Conditions take booleans.
Supply a fallbackx ?? 5 uses 5 when x is none.
Generate an inclusive range2..5 produces [2, 3, 4, 5]. 3..1 counts down.
Index or sliceitems[0], items[-1], items[2:5], items[:3], items[1:]. The stop index is excluded.
Displaysay "Hi, {name}!" or say "Answer:", 6 * 7. Comma-separated values get a space between them.

Precedence goes from calls and lookups through powers, unary signs, multiplication and division, addition and subtraction, ranges, comparisons and membership, equality, boolean negation, and, or, fallback, and finally queries. Powers associate to the right. -2 ** 2 is −4 and 2 ** -2 is 0.25. Use 0 <= x and x <= 10 for a bounded comparison. Quoted strings use JSON escapes such as \n. In a displayed template {user.name} inserts a field and {{ prints a literal brace. Use $"Hello, {name}" when building a template in an ordinary expression.

Repeat and iterate

total = 0
repeat 4 times as turn
    total += turn
say total
for letter, score in zip(["A", "B"], [9, 7])
    say "{letter} scored {score}"
while total > 0
    total -= 1

repeat 4 runs the body four times. times and as turn are optional. The counter starts at 1. repeat 0 skips the body. Use for item in items to walk a list, text characters, map keys or a Python iterable. Several loop names unpack equal-length lists. break exits the innermost loop and continue skips to its next iteration.

Functions and automatic caching

to square(n) = n ** 2

memo to fib(n)
    if n < 2
        return n
    return fib(n - 1) + fib(n - 2)

say square(12), fib(35)

The output is 144 9227465. A one-expression function returns its expression. Use return inside a block function. Reaching the end returns none. Functions can recurse, nest, close over names and be passed as values. An anonymous function looks like fn(n) => n * 2.

memo to remembers successful results for each set of argument values. In the call above, Bowen computes 36 distinct Fibonacci inputs, including zero. Defaults and named arguments share the same cache once bound. Choose this form for a function whose answer depends on its inputs. The cache lives with the function and grows with its distinct inputs. Recursive functions still use the interpreter's call stack.

to area(width, height = width) = width * height
say area(3)
say area(height: 4, width: 5)

A default may use an earlier parameter. Positional arguments precede named arguments. The two outputs here are 9 and 20.

to total(label, ...amounts) = $"{label}: {amounts.sum()}"
say total("Groceries", 4, 2.5, 3)

shout = fn(words)
    loud = words.upper()
    return loud + "!"
say shout("hello")

to counter()
    clicks = 0
    to click()
        clicks += 1
        return clicks
    return click
tap = counter()
say tap(), tap()

This prints Groceries: 9.5, HELLO! and 1 2. A last parameter written ...amounts collects any extra arguments into a list. An anonymous fn(...) at the end of a line can have an indented body. Inside a function, += and the other updating operators change the nearest existing variable, even one in an enclosing function. Plain = still creates a new local name.

Objects, methods and text

Records with methods

record Account(owner: text, balance: number = 0)
    to deposit(amount)
        assert amount > 0, "Deposit a positive amount."
        balance += amount
        return balance

    to withdraw(amount)
        if amount > balance
            throw $"{owner} has only {balance:.2f}."
        balance -= amount

    to describe() = $"{owner}: {balance:,.2f}"

savings = Account("Aya")
savings.deposit(1200)
savings.withdraw(150.5)
say savings.describe()

This prints Aya: 1,049.50. A record declares typed fields, optionally with defaults, and indented to methods. Inside a method each field works like a local variable. Assigning to it, as in balance += amount, updates the record. self names the whole record, so self.describe() calls another method. When a method changes fields, Bowen stores the updated record back into the variable, list item or field you called it on, such as accounts[0].deposit(5).

Fields with defaults must come after fields without them. Field types are checked when the record is built and whenever a method changes a field, so Account("Aya", "lots") fails with a clear message. Records are values, like numbers. backup = savings keeps an independent copy that later deposits do not change.

Methods on every value

cart = ["tea", "jam"]
cart.append("cake")
cart.sort()
say cart, cart.len(), cart.join(" + ")
say "  Hello  ".strip().upper(), 3.14159.round(2), 1234.5.fixed()
prices = {tea: 2.5}
say prices.get("coffee", 0), prices.has("tea")

Every text, number, list and map has methods. Type a value and . in VS Code to see them all. Most methods are the library function of the same name, so cart.sorted() is sorted(cart) and name.upper() is str.upper(name). Common Python spellings also work, such as strip, startswith, split() with no separator and ", ".join(items).

These methods update the variable they are called on and return none: append (or push), extend, insert, remove, pop (which returns the removed item), clear, sort and reverse for lists, and remove, pop, clear and update for maps. For a changed copy instead, use sorted(), reversed() or shuffled().

Any function you write can be called the same way. After to double(n) = n * 2, the expression 21.double() is 42.

Templates and number formatting

item = "Tea"
price = 2.5
quantity = 3
say "{quantity} x {item:<6} {price * quantity:>8.2f}"
say "Discount: {0.125:.1%}   Visitors: {1234567:,}"
receipt = $"Total {price * quantity:.2f}"
say """
    Thank you for shopping!
    {receipt}
    """

Inside {} you can write any expression, including method calls and "a" if ok else "b". Add a format after a colon, as in Python: .2f for two decimals, , for thousands separators, .1% for a percentage, and <6, >8 or ^10 to align within a width. Text in say and ask lines is a template automatically. Elsewhere put $ before the quote, as in $"Total {price}". Ordinary strings keep their braces. Write {{ and }} for literal braces. Triple quotes make multi-line text and remove the shared indentation. Single quotes work too, which helps inside templates: "{'none' if items.isEmpty() else items.join(', ')}".

Types that are actually checked

record Point(x: number, y: number)
enum Size(small, medium, large)

to area(width: number, height: number) -> number = width * height

to price(size: Size) -> number
    return match(size) {
        case "small" => 2.5
        case "medium" => 3
        else => 3.5
    }

to move(p: Point, steps: int = 1) -> Point
    return Point(p.x + steps, p.y)

say area(3, 4.5), price(Size.large), move(Point(1, 2)).x
say Size.all

This prints 13.5 3.5 2, then ["small", "medium", "large"]. Write name: type after a parameter and -> type after the parentheses. Unlike Python's type hints, Bowen checks them on every call: area("3", 4) stops with width in area must be a number, got text. Types are text, number, int, bool, list, map, function, any, or the name of one of your records or enums. Annotations are optional, so add them where a mistake would be costly.

enum lists a fixed set of choices. Size.medium is the text "medium", so enum values print, compare, save to JSON and work in match like any text. Size.all lists every value, which fits ask size from Size.all. A parameter typed Size rejects anything else.

Shortcuts for everyday data

user = {name: "Aya", address: {city: "Oslo"}}
guest = {name: "Sol"}
say user?.address?.city, guest?.address?.city ?? "unknown"

defaults = {color: "blue", size: 2}
style = {...defaults, color: "red"}
more = [...[1, 2], 3]
to total(...amounts) = amounts.sum()
say style, more, total(...more)

letters = ["a", "b", "c"]
for i in 0..<len(letters)
    say i, letters[i]
ShortcutMeaning
a?.bnone if a is none or has no field b, instead of an error. a?.method() works too. Combine it with ?? for a fallback.
[...list, item], {...map, key: value}Copy every item or field into a new list or map. Later fields win.
f(...list)Pass a list's items as separate arguments.
0..<5[0, 1, 2, 3, 4]: a range that stops before its end, handy with len.

Errors that carry details

to withdraw(balance, amount)
    if amount > balance
        throw {message: "Not enough money.", code: "low_balance", short: amount - balance}
    return balance - amount

try
    withdraw(10, 25)
catch problem
    say problem.message, problem.code
    say "You need {problem.value.short} more."

Throw a map with a message and a code to give catch everything it needs. problem.value is exactly what was thrown. Errors that Bowen raises itself have a code too, and their value is none.

Get data from the internet

weather = web.json("https://api.open-meteo.com/v1/forecast?latitude=59.9&longitude=10.7&current=temperature_2m")
say "It is {weather.current.temperature_2m} degrees in Oslo."
FunctionWhat it does
web.get(url)The page or file at the address, as text.
web.json(url)Fetch JSON and turn it into Bowen lists and maps.
web.post(url, value)Send a value as JSON and return the reply, decoded when it is JSON.
web.download(url, path)Save the file at the address into your project.

Addresses must start with http:// or https://. Each request waits up to 20 seconds. Problems arrive as ordinary errors with codes such as http_404 or web_unreachable, so try and catch can handle them. Python needs the third-party requests package to make this as short.

Python habits that work in Bowen

You can writeMeaning
"adult" if age >= 18 else "child"Choose between two values.
1 < x < 10Both comparisons must hold.
name not in bannedMembership test, negated.
"-" * 20, [0] * 3Repeat text or a list.
passAn empty block.
try … catch problem … finallyThe finally block always runs, even after return.
"""multi-line text""", 'single quotes'Other ways to write text.

Bowen stays stricter than Python where it prevents bugs. Conditions must be true or false, so write if not items.isEmpty() rather than if items. else if is two words. none, true and false are lowercase.

Work with whole collections

scores = [72, 95, 64, 88, 91]
best = scores where it >= 70 sort by it desc take 3
say best

Bowen prints [95, 91, 88]. Each stage receives the previous stage's result. Inside an item expression, it is the current item. A sort keeps the original relative order of items whose keys compare equal. Multiline queries start each continuation line with |>.

scores = [72, 95, 64, 88, 91]
adjusted = scores
    |> where it >= 70
    |> select it + 2
    |> sort by it desc
    |> take 3
say adjusted
QuestionStage after a list
Which items match?where condition
What should each become?select expression
Which keys come first?sort by expression, optionally desc
Which slice or unique items?take n, skip n, distinct by expression
How many? Which first?count, first. An empty list has no first item and returns none.
How much?sum it, average it, min it, max it. Change it to a field or another expression.
Do any or all match?some condition, every condition
How do they group?group by it.team returns records with key and items.
Which rows match across lists?join others on it.id equals it.owner gives rows with left and right.

For more than one metric per group use |> summarize by it.team {games: count, points: sum it.score}. Stages operate on finite lists and materialize intermediate values. For streaming input you can iterate an imported Python iterator with for.

Word frequency in four lines

counts = tally(words(str.lower("Code to learn. Learn to code.")))
ranked = pairs(counts) sort by it[1] desc
for word, hits in ranked
    say "{word} appeared {hits} times."

words separates punctuation and whitespace, preserving internal apostrophes. It includes runs of letters and digits. tally counts text keys in first-seen order. To analyze a file instead, give str.lower the result of fs.read("notes.txt").

FunctionResult
words(text), tally(listOfText)Word list and occurrence counts
pairs(map), indexed(sequence)A list of key/value or zero-based index/value pairs
zip(left, right)Pairs from both inputs, ending with the shorter one
windows(items, width)Every overlapping list of the given positive width
collect(iterable)A Bowen list of every item yielded
fold(items, initial, function)Repeatedly combine the accumulator and next item

Everyday helpers

prices = {tea: 2.5, cake: 4, scone: 3.25}
for item, price in pairs(prices)
    say str.padRight(item, 8, "."), str.padLeft(str.fixed(price), 6)
say "Total:", str.fixed(math.sum(values(prices)))
random.seed(1)
say "Today's special:", random.pick(keys(prices))

Each price prints on a line padded with dots, then the total 9.75. The special is the same on every run because of random.seed. Remove that line for a fresh pick each time.

FunctionResult
range(start, end, step)Counts from start to end, including end. range(0, 10, 5) is [0, 5, 10].
sorted(items, key, descending)A sorted copy. Pass none as the key to sort the items themselves and true last for largest first.
map(items, f), filter(items, f), find(items, f)Transform each item, keep matches, or get the first match (none if none).
unique, reverse, flatten, indexOf(items, value)Remove duplicates, reverse, join nested lists, or locate an item (-1 if missing).
str.contains, str.find, str.count, str.repeatSearch inside text or repeat it.
str.padLeft(s, width, fill), str.padRight, str.fixed(x, digits), str.titleLine up columns, format decimals with thousands separators, capitalize words.
str.isNumber(s)Check text before calling toNumber.
math.sum, math.min, math.max, math.clamp, math.piWork with a list of numbers or several numbers.
random.int(1, 6), random.pick, random.shuffle, random.sample, random.seedDice, cards and repeatable randomness.
time.now(), time.clock(), time.sleep(0.5)Timestamps, timing and pauses.
help(), help(str)List the built-in functions, or one module's functions.

The extended reference describes every function in detail.

AI in your programs

Install an AI extension

Bowen installs AI extensions the way Python installs packages, but setup stops there. Open PowerShell in the release folder, or use Bowen: Install Extension in VS Code.

.\bowen.cmd install claude
.\bowen.cmd key claude

The first command installs Anthropic's official Python library. The second asks you to paste an API key from console.anthropic.com. The key is hidden while you paste it and saved in your user profile. For ChatGPT use install chatgpt and key chatgpt with a key from platform.openai.com. Using an AI service costs money on that service's account. bowen extensions shows what is installed and ready. If you already set the ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable, Bowen uses it and you can skip the key step.

bowen install also installs any other Python package. After bowen install requests you can write use python requests.

Ask, extract, classify and chat

use claude

say claude.ask("Suggest a name for a bakery that sells only bread")

record Contact(name: text, email: text, company: text)
contact = claude.extract("Hi, I'm Mira Lund from Northwind, mira@northwind.example", Contact)
say "{contact.name} works at {contact.company}"

reviews = ["Fast delivery, great bread", "Arrived cold and late"]
moods = reviews select claude.classify(it, ["happy", "unhappy"])
say moods

tutor = claude.chat("You are a patient maths tutor. Answer in two sentences.")
say tutor.send("Why can't I divide by zero?")
say tutor.send("Give me an example.")
FunctionWhat it does
ask(prompt, instructions)Returns the answer as text. Optional instructions set the rules, such as "Answer in French.".
extract(text, Record)Fills a record's fields from the text, with every field type checked.
classify(text, choices)Returns exactly one of the choices you list.
chat(instructions)Starts a conversation that remembers earlier messages. Call .send(message) on it. .history() lists the messages and .reset() starts over.

use chatgpt offers the same four functions. use ai picks whichever extension you set up, so a program works with either service. bowen model ai chatgpt chooses one explicitly. The answers are ordinary Bowen values, so they work in queries, templates and records. A prompt built from values needs a template outside say, as in claude.ask($"Summarize: {note}").

Claude uses Claude Opus 5.5 unless you choose another model with bowen model claude claude-sonnet-5-5. If it declines a request, it automatically retries on a fallback model. ChatGPT uses the model shown by bowen model chatgpt. Change it with bowen model chatgpt <model-id> when OpenAI releases new models. Errors explain the next step, for example "Claude did not accept the API key. Run: bowen key claude". A local file named claude.bow takes priority over the extension.

Describe a search

answer = solve best
    choose x from 1..12
    choose y from x..12
    area = x * y
    require 2 * (x + y) == 24
    maximize area
    yield [x, y, area]
say answer

Bowen prints [6, 6, 36]. You supply the possible values, rules and goal. Bowen searches the finite combinations in their written order. Put a require as soon as its inputs are known to skip the rest of an invalid branch. An assignment inside the search derives a name for the current candidate. It is visible in later clauses and the result.

solve collects every answer. solve first stops at the first match. solve best compares one or more minimize or maximize objectives in order. The first tied candidate wins. A single-answer search with no match returns none. Large domains can take time because the interpreter enumerates candidates. Open change.bow to see the same feature find exact change with the fewest coins.

Build larger programs

Modules and records

Put the following in geometry.bow.

record Point(x: number, y: number)
to length(point) = math.sqrt(point.x ** 2 + point.y ** 2)

In main.bow in the same folder, write this.

use geometry
origin_to_point = geometry.length(geometry.Point(3, 4))
say origin_to_point

use geometry loads the neighboring file exactly once per run. Top-level bindings in a .bow module are public by default. Start a name with an underscore to keep it private. For a different path, use use "parts/geometry.bow" as geo. The starters/toolkit folder contains a runnable two-file example and tests. Older .rowan modules use explicit export. The interpreter diagnoses circular local imports.

A record declares its fields and optionally their types. Point(x: 3, y: 4) constructs one. Records and maps support dot access. A field type can be any, text, number, int, bool, list or map.

Files, data and errors

readings = [12, 18, 15]
json.write("readings.json", readings)
restored = json.read("readings.json")
say restored average it

File paths passed to the Bowen standard library are relative to the entry program's folder. Local module imports are relative to the importing source file. Standard modules include fs for files, json and csv for data, str for text, math, stats and date. They are ready to use without imports. args() returns command-line arguments as text.

try
    throw "Missing reading"
catch problem
    say problem.message

A caught error has message, code, file, line and column. assert condition, "explanation" fails with your message. For structured data dispatch, use a match expression with patterns. This expression returns the first matching result.

reading = {kind: "temp", value: 18}
label = match(reading) {
    case {kind: "temp", value: n} => $"Temperature {n}"
    else => "Unknown reading"
}
say label

The extended reference covers all inherited features, including pattern guards, the aggregate query table, functions for text and disk formats, forms, SQLite collections and HTML reports. Braced examples there use the compatible Rowan dialect. The Bowen grammar notes describe the syntax added for .bow files.

Use Python libraries

use python statistics
use python itertools
samples = [4, 8, 7, 5, 6]
say windows(samples, 3) select statistics.median(it)
for a, b in itertools.combinations("ABC", 2)
    say "{a} + {b}"

The medians are [7, 7, 6]. Imports can use dotted names and aliases, such as use python datetime as dt. Call a function, construct an object, or read an attribute with dot syntax. Pass keywords using Bowen's name: value syntax. Python functions can call a Bowen function supplied as an argument, for example builtins.sorted(names, key: size) after importing builtins and defining size.

Text, booleans, numbers and None convert to their Bowen equivalents. Lists, tuples and text-keyed dictionaries cross by value. Python objects such as dates and iterators stay as handles with named attributes and methods. Use collect to materialize a finite iterator. Library calls that raise an ordinary Python exception produce a catchable Bowen error. Native libraries can also raise process-level exits. Prefer synchronous callbacks. GUI event loops, background threads, native binary extensions and every third-party package have not been verified with Studio.

Python imports use the interpreter that starts Bowen. For a third-party package installed in a chosen virtual environment, use that environment's Python to run bowen.py. The portable runtime is intended for the bundled toolchain. A packed project includes local Bowen imports and the assets you select. Recipients need any additional Python packages used by the project.

Run, debug, test and share

In PowerShell from the release folderAction
.\bowen.cmd run starters\numbers.bowRun a file. Append -- and optional arguments for args().
.\bowen.cmd check starters\toolkit\main.bowCheck syntax in the entry file and its local imports. Python imports resolve when executed.
.\bowen.cmd debug starters\numbers.bowStart the line debugger.
.\bowen.cmd replEvaluate code interactively. Press Enter on a blank line to run an indented block. Use .edit and .end for a paste.
.\bowen.cmd test startersFind and run *.test.bow and *.test.rowan recursively.
.\bowen.cmd testRun the interpreter and tooling regression suite.
.\bowen.cmd pack starters\toolkit\main.bow -o Geometry.zipPackage the entry file, its local imports, runner and Windows launcher.

Your first breakpoint

Open numbers.bow in Studio. Click the line number beside return n inside the base case. Click Debug, then Continue. Execution pauses before the return. Select a call frame to see that call's value of n. Enter n + 1 in Inspect expression. Into executes one statement, Over runs over calls, and Out runs until the selected execution depth returns. Stop ends the run. Cached calls return immediately.

The terminal debugger supports b 3, b 3 if n == 1, c (continue), s (step), n (next), o (step out), p expression, locals, stack, up, down, list and q. help lists every command. Both debuggers use the original file and line positions.

Write tests and distribute a program

to triple(n) = n * 3
test "tripling a negative number"
    assert triple(-2) == -6

Save this as math.test.bow, open it in Studio and click Test. Each case starts with fresh in-memory bindings. Top-level setup executes before each case and file changes persist. Run skips test bodies. The test command returns a nonzero exit code on failure.

To share a program, run pack as shown above. Include data with --asset notes.txt and choose a common source directory with --root when imports live in sibling folders. Extract the resulting ZIP and open Run App.cmd in Bowen-App. Projects can also be shared directly as plain source.

Troubleshooting

What you seeWhat to do
“Indent the body below this line”Indent the first statement under the header. Use spaces. Match the indentation of sibling lines.
“Unknown name … Did you mean …?”Bowen suggests the closest name it knows. Check spelling, capitalization and whether the assignment actually ran.
“Cannot use + with text and int”Turn the number into text with text(n), or put both in a say separated by commas.
“is a reserved word”Words such as count, sum, first and select are query stages. Choose another name.
“Too many nested calls”A recursive function never reaches its stopping case. Bowen allows thousands of nested calls.
“Text values have no method …”The suggestion names the closest method. In VS Code, type . after the value to list them all.
“if needs bool, got list”Conditions must be true or false. Write if not items.isEmpty() instead of if items.
“A record body can only define methods”Under a record line, indent only to methods. Move other code below the record.
An AI assistant writes Python instead of BowenRun Bowen: Teach AI Assistants Bowen in VS Code, or copy guide\BOWEN-AI-GUIDE.md into your project as CLAUDE.md or AGENTS.md.
Studio cannot run the selected fileSave the source with a .bow or .rowan extension. Click a source file in the project.
Python module import failsCheck that the module is installed in the runtime used to start Bowen.
Setup cannot download the portable runtimeUse an installed Python 3.10+ and launch py -3 bowen.py studio from the release folder.