# TinyS – Python-shaped syntax with Rust semantics

> Source: <https://github.com/ewiger/TinyS/blob/main/TLDR.md>
> Published: 2026-07-22 00:41:05+00:00

If you are an AI developer wanting to learn rust, you can take all your python knowledge and put it into TinyS ;-)

**Python-shaped syntax, Rust semantics, native binaries.**

You write indentation-based `.sn`

source; it transpiles to Rust and compiles to
a native binary. No GC, no runtime — ownership, borrowing, lifetimes, traits,
and `Result`

-based errors all carry over from Rust unchanged.

```
.sn source  →  generated .rs  →  rustc / Cargo  →  native binary
```

Python's *look*, not Python's *guarantees*: conditions must be `bool`

, matches
are exhaustive, no implicit truthiness, no implicit conversion, no `null`

.

| TinyS | Rust |
|---|---|
`def f(x: i32) -> i32:` |
`fn f(x: i32) -> i32 {}` |
`list[i32]` / `dict[str,i32]` |
`Vec<i32>` / `HashMap<…>` |
`ref T` / `mut ref T` |
`&T` / `&mut T` |
`at value` |
`*value` |
`.a` , `.source` |
`'a` , `'source` |
`Result[User, Error]` |
`Result<User, Error>` |
`match` / `case` |
`match` arms |
`and` / `or` / `not` |
`&&` / `||` / `!` |
`str` / `ref str` |
`String` / `&str` |
`from rust.regex import …` |
`use regex::…` |

``` python
from rust.serde import Serialize, Deserialize

#[derive(Debug, Clone, Serialize, Deserialize)]
struct User:
    id: u64
    name: str

impl User:

    def greeting(self: ref Self) -> str:
        return format("Hello, {}", self.name)

def main() -> void:
    user = User(id=1, name="Ada")
    print(user.greeting())
```

**Immutable by default**—`count = 0`

, opt into mutation with`mut total = 0`

.**Borrowing is a keyword**—`ref`

/`mut ref`

instead of`&`

/`&mut`

; dereference with`at`

;`move`

for explicit ownership transfer.**Errors**—`Result`

/`Option`

,`?`

propagation,`none`

for absence. No exceptions.**Pattern matching**— exhaustive, an expression;`_`

wildcard,`|`

alternatives,`if`

guards,`as`

binds the whole value.**Control flow is expression-oriented**—`if`

,`match`

, and`loop`

produce values.**Async**—`async def`

with postfix`.await`

.**Rust interop is always visible**— crates come through the`rust`

root (`from rust.serde import …`

); macros are imported and called without`!`

.**Packaging**—`tinys.toml`

maps onto Cargo; modules follow the file layout.

Full design drafts live in [doc/draft/](/ewiger/TinyS/blob/main/doc/draft); see the [README](/ewiger/TinyS/blob/main/README.md)
for the complete tour.
