# Tampiorama A showcase for [Tampio](https://github.com/fergusq/tampio), a natural-language object-oriented programming language that uses Finnish grammar and compiles to JavaScript. Tampiorama provides working, annotated examples and documentation to help you explore Tampio without wrestling with its native dependencies. ## Quickstart (Docker) The easiest way to try Tampio, no manual `libvoikko` setup required. Compile all examples to HTML (the `.html` files are not committed — they're generated from the `.itp` sources): ```sh make ``` Then serve locally and open in your browser: ```sh python3 -m http.server 9994 --directory examples ``` Open `http://localhost:9994/basics/index.html` for the full example index, or go directly: | URL | What it does | |-----|-------------| | `http://localhost:9994/basics/hello.html` | Alerts "Hei maailma!" on load | | `http://localhost:9994/basics/factorial.html` | Prompts for n, displays n! | | `http://localhost:9994/basics/fibonacci.html` | Prompts for n, displays fib(n) | | `http://localhost:9994/data-structures/lista.html` | List sorted ascending and descending | | `http://localhost:9994/data-structures/vektori.html` | Custom class, Euclidean length of [3,4] = 5 | | `http://localhost:9994/strings/merkkijono.html` | String length, concat, trim, split | | `http://localhost:9994/async/nappi.html` | Click handlers, mutable counter (visual tally) | | `http://localhost:9994/program/kasvutaulukko.html` | Factorial and Fibonacci sequences for n=1..7 | ## What is Tampio? Tampio programs read like Finnish sentences. Methods are defined using grammatical cases, so the language's syntax is shaped by natural-language morphology rather than punctuation. ```tampio Pienen luvun kertoma on riippuen siitä, onko se pienempi tai yhtä suuri kuin yksi, joko yksi tai pieni luku kerrottuna pienen luvun edeltäjän kertomalla. ``` `pienen luvun kertoma` — "the factorial of a small number". The parameter `pieni luku` (small number) appears in genitive case before the method name, and the recursive call `pienen luvun edeltäjän kertomalla` reads as "by the factorial of the predecessor of the small number". See [`docs/cheatsheet.md`](docs/cheatsheet.md) for a map of Finnish grammatical cases to their roles in Tampio code, and [`docs/vs-javascript.md`](docs/vs-javascript.md) for side-by-side comparisons with JavaScript. ## Examples | Directory | Contents | |-----------|----------| | `examples/basics/` | Hello world, factorial, Fibonacci | | `examples/data-structures/` | Built-in list operations, custom class | | `examples/strings/` | String length, concat, trim, split | | `examples/async/` | DOM click handlers, mutable state | | `examples/program/` | Capstone combining recursion and list iteration | ## Testing See [`docs/testing.md`](docs/testing.md) for a step-by-step guide to verifying each example. ## Local Setup (without Docker) See [`docs/install.md`](docs/install.md) for instructions on installing `libvoikko` and `tampio` natively. ## License MIT