Skip to content

Repository files navigation

Prose

A tiny programming language that reads as plain English — and, unlike most "English-like" languages, is still writable, because it accepts one fixed set of sentence shapes with no synonyms and no optional word order.

to damage target by amount
  subtract amount from health of target
  if health of target is less than 1
    say "down!"

set goblin to record with health 10 and name "Grok"
damage the goblin by 3
say health of goblin        # 7

Indentation makes blocks. The articles a, an, and the are ignored, so you write for the reader. There are no symbols beyond grouping parentheses and the quotes around text.

New to Prose? Start with docs/getting-started.md and the language tour. For the precise grammar and semantics, see SPEC.md. Editor highlighting lives in editors/vscode-prose.

Run it

go build -o prose ./cmd/prose

./prose run testdata/programs/recursion.prose   # run a file
./prose repl                                     # interactive session

The REPL keeps its state between lines: define a verb or set a variable on one line and use it on the next. Enter a block (if, repeat, for each, to) and keep typing indented lines; a blank line runs the block.

Layout

Package Role
token Lexical tokens — the lexer→parser contract.
ast AST node types — the parser→interpreter contract.
langerr The one error type: position, concept, message.
lexer Source text → tokens, with INDENT/DEDENT for blocks.
parser Tokens → AST (hand-written recursive descent).
interp Tree-walking interpreter over the AST.
proserun Wires lex → parse → interpret; the single entry point.
cmd/prose The prose run and prose repl command.
testdata/programs Sample programs paired with expected output — the acceptance suite.

Develop

go build ./...
go vet ./...
go test ./...

No third-party dependencies: standard library only, tested with the built-in testing package. The acceptance suite in proserun runs every sample program and checks it against its .out (exact output) or .err (expected error).

Contributions are welcome — see CONTRIBUTING.md.

License

MIT © Paolo Bozzini

About

A tiny programming language whose source reads as plain English — tree-walking interpreter in Go, zero dependencies.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages