<commit_before># Puffs the Language

Puffs is an imperative, C-like language and much of it should look familiar to
somebody versed in any one of C, C++, D, Go, Java, JavaScript, Objective-C,
Rust, Swift, etc. Accordingly, this section is not an exhaustive specification,
merely a rough guide of where Puffs differs.

Like Go, [semi-colons can be omitted](https://golang.org/ref/spec#Semicolons),
and `puffsfmt` will remove them. Similarly, the body of an `if` or `while` must
be enclosed by curly `{}`s. There is no 'dangling else' ambiguity.


## Keywords

The Puffs language has 24 keywords. 7 of those introduce top-level concepts:

- `const`
- `error`
- `func`
- `packageid`
- `struct`
- `suspension`
- `use`

2 keywords distinguish between public and private API:

- `pri`
- `pub`

6 keywords deal with control flow within a function:

- `break`
- `continue`
- `else`
- `if`
- `return`
- `while`

5 keywords deal with assertions:

- `assert`
- `inv`
- `post`
- `pre`
- `via`

2 keywords deal with types:

- `nptr`
- `ptr`

1 keyword deals with local variables:

- `var`

1 keyword deals with I/O:

- `limit`


## Operators

All binary operators have equal precedence. `a * b + c` is an invalid
expression. You must explicitly write either `(a * b) + c` or `a * (b + c)`.

Some binary operators (`+`, `*`, `&`, `|`, `^`, `and`, `or`) are also
associative: `(a + b) + c` and `a + (b + c)` are equivalent, and can be written
as `a + b + c`.

The logical operators, `&&` and `||` and `!` in C, are written as `and` and
`or` and `not` in Puffs.

TODO: ignore-overflow ops, equivalent to Swift's `&+`.

Converting an expression `x` to the type `T` is written as `x as T`.


## Types

Types read from left to right: `ptr [100] u32` is a pointer to a 100-element
array of unsigned 32-bit integers. `ptr` here means a non-null pointer. Use
`nptr` for a nullable pointer type.
<commit_msg>Add TODO to describe more keywords.<commit_after># Puffs the Language

Puffs is an imperative, C-like language and much of it should look familiar to
somebody versed in any one of C, C++, D, Go, Java, JavaScript, Objective-C,
Rust, Swift, etc. Accordingly, this section is not an exhaustive specification,
merely a rough guide of where Puffs differs.

Like Go, [semi-colons can be omitted](https://golang.org/ref/spec#Semicolons),
and `puffsfmt` will remove them. Similarly, the body of an `if` or `while` must
be enclosed by curly `{}`s. There is no 'dangling else' ambiguity.


## Keywords

7 keywords introduce top-level concepts:

- `const`
- `error`
- `func`
- `packageid`
- `struct`
- `suspension`
- `use`

2 keywords distinguish between public and private API:

- `pri`
- `pub`

6 keywords deal with control flow within a function:

- `break`
- `continue`
- `else`
- `if`
- `return`
- `while`

5 keywords deal with assertions:

- `assert`
- `inv`
- `post`
- `pre`
- `via`

2 keywords deal with types:

- `nptr`
- `ptr`

1 keyword deals with local variables:

- `var`

1 keyword deals with I/O:

- `limit`

TODO: categorize and, or, not, as, false, true, in, out, this, u8, u16, etc.


## Operators

All binary operators have equal precedence. `a * b + c` is an invalid
expression. You must explicitly write either `(a * b) + c` or `a * (b + c)`.

Some binary operators (`+`, `*`, `&`, `|`, `^`, `and`, `or`) are also
associative: `(a + b) + c` and `a + (b + c)` are equivalent, and can be written
as `a + b + c`.

The logical operators, `&&` and `||` and `!` in C, are written as `and` and
`or` and `not` in Puffs.

TODO: ignore-overflow ops, equivalent to Swift's `&+`.

Converting an expression `x` to the type `T` is written as `x as T`.


## Types

Types read from left to right: `ptr [100] u32` is a pointer to a 100-element
array of unsigned 32-bit integers. `ptr` here means a non-null pointer. Use
`nptr` for a nullable pointer type.

{'fraction_non_alphanumeric': 0.13693270735524257, 'fraction_numerical': 0.010172143974960876, 'mean_word_length': 3.614921780986763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1173641', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1301, 'n_words': 568}