hugo website for pit
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
.git/
|
.git/
|
||||||
.obj/
|
.obj/
|
||||||
website/
|
website/public/
|
||||||
|
website/.hugo_build.lock
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
*.zip
|
*.zip
|
||||||
@@ -15,6 +16,7 @@ build/
|
|||||||
source/shaders/*.h
|
source/shaders/*.h
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.html
|
*.html
|
||||||
|
!website/themes/**/*.html
|
||||||
.vscode
|
.vscode
|
||||||
*.icns
|
*.icns
|
||||||
icon.ico
|
icon.ico
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
nav:
|
|
||||||
- index.md
|
|
||||||
- cellscript.md
|
|
||||||
- actors.md
|
|
||||||
- packages.md
|
|
||||||
- cli.md
|
|
||||||
- c-modules.md
|
|
||||||
- Standard Library: library
|
|
||||||
|
|
||||||
74
docs/_index.md
Normal file
74
docs/_index.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
---
|
||||||
|
title: "Documentation"
|
||||||
|
description: "ƿit language documentation"
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
ƿit is an actor-based scripting language for building concurrent applications. It combines a familiar C-like syntax with the actor model of computation, optimized for low memory usage and simplicity.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- **Actor Model** — isolated memory, message passing, no shared state
|
||||||
|
- **Immutability** — `stone()` makes values permanently frozen
|
||||||
|
- **Prototype Inheritance** — objects without classes
|
||||||
|
- **C Integration** — seamlessly extend with native code
|
||||||
|
- **Cross-Platform** — deploy to desktop, web, and embedded
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// hello.ce - A simple actor
|
||||||
|
log.console("Hello, ƿit!")
|
||||||
|
$stop()
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pit hello
|
||||||
|
```
|
||||||
|
|
||||||
|
## Language
|
||||||
|
|
||||||
|
- [**ƿit Language**](/docs/language/) — syntax, types, and built-in functions
|
||||||
|
- [**Actors and Modules**](/docs/actors/) — the execution model
|
||||||
|
- [**Packages**](/docs/packages/) — code organization and sharing
|
||||||
|
- [**Command Line**](/docs/cli/) — the `pit` tool
|
||||||
|
- [**Writing C Modules**](/docs/c-modules/) — native extensions
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
- [**Built-in Functions**](/docs/functions/) — intrinsics reference
|
||||||
|
|
||||||
|
## Standard Library
|
||||||
|
|
||||||
|
- [text](/docs/library/text/) — string manipulation
|
||||||
|
- [number](/docs/library/number/) — numeric operations (functions are global: `floor()`, `max()`, etc.)
|
||||||
|
- [array](/docs/library/array/) — array utilities
|
||||||
|
- [object](/docs/library/object/) — object utilities
|
||||||
|
- [blob](/docs/library/blob/) — binary data
|
||||||
|
- [time](/docs/library/time/) — time and dates
|
||||||
|
- [math](/docs/library/math/) — trigonometry and math
|
||||||
|
- [json](/docs/library/json/) — JSON encoding/decoding
|
||||||
|
- [random](/docs/library/random/) — random numbers
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
ƿit programs are organized into **packages**. Each package contains:
|
||||||
|
|
||||||
|
- **Modules** (`.cm`) — return a value, cached and frozen
|
||||||
|
- **Actors** (`.ce`) — run independently, communicate via messages
|
||||||
|
- **C files** (`.c`) — compiled to native libraries
|
||||||
|
|
||||||
|
Actors never share memory. They communicate by sending messages, which are automatically serialized. This makes concurrent programming safe and predictable.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone and bootstrap
|
||||||
|
git clone https://gitea.pockle.world/john/cell
|
||||||
|
cd cell
|
||||||
|
make bootstrap
|
||||||
|
```
|
||||||
|
|
||||||
|
The ƿit shop is stored at `~/.pit/`.
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
# Actors and Modules
|
---
|
||||||
|
title: "Actors and Modules"
|
||||||
|
description: "The ƿit execution model"
|
||||||
|
weight: 20
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Cell organizes code into two types of scripts: **modules** (`.cm`) and **actors** (`.ce`).
|
ƿit organizes code into two types of scripts: **modules** (`.cm`) and **actors** (`.ce`).
|
||||||
|
|
||||||
## The Actor Model
|
## The Actor Model
|
||||||
|
|
||||||
Cell is built on the actor model of computation. Each actor:
|
ƿit is built on the actor model of computation. Each actor:
|
||||||
|
|
||||||
- Has its own **isolated memory** — actors never share state
|
- Has its own **isolated memory** — actors never share state
|
||||||
- Runs to completion each **turn** — no preemption
|
- Runs to completion each **turn** — no preemption
|
||||||
@@ -62,10 +67,10 @@ An actor is a script that **does not return a value**. It runs as an independent
|
|||||||
// worker.ce
|
// worker.ce
|
||||||
log.console("Worker started")
|
log.console("Worker started")
|
||||||
|
|
||||||
$on_message = function(msg) {
|
$receiver(function(msg, reply) {
|
||||||
log.console("Received:", msg)
|
log.console("Received:", msg)
|
||||||
// Process message...
|
// Process message...
|
||||||
}
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
**Key properties:**
|
**Key properties:**
|
||||||
@@ -177,11 +182,11 @@ $time_limit(my_requestor, 10) // 10 second timeout
|
|||||||
|
|
||||||
## Module Resolution
|
## Module Resolution
|
||||||
|
|
||||||
When you call `use('name')`, Cell searches:
|
When you call `use('name')`, ƿit searches:
|
||||||
|
|
||||||
1. **Current package** — files relative to package root
|
1. **Current package** — files relative to package root
|
||||||
2. **Dependencies** — packages declared in `cell.toml`
|
2. **Dependencies** — packages declared in `pit.toml`
|
||||||
3. **Core** — built-in Cell modules
|
3. **Core** — built-in ƿit modules
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// From within package 'myapp':
|
// From within package 'myapp':
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
# Writing C Modules
|
---
|
||||||
|
title: "Writing C Modules"
|
||||||
|
description: "Extending ƿit with native code"
|
||||||
|
weight: 50
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Cell makes it easy to extend functionality with C code. C files in a package are compiled into a dynamic library and can be imported like any other module.
|
ƿit makes it easy to extend functionality with C code. C files in a package are compiled into a dynamic library and can be imported like any other module.
|
||||||
|
|
||||||
## Basic Structure
|
## Basic Structure
|
||||||
|
|
||||||
@@ -45,12 +50,12 @@ Where:
|
|||||||
- `<filename>` is the C file name without extension
|
- `<filename>` is the C file name without extension
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
- `mypackage/math.c` → `js_mypackage_math_use`
|
- `mypackage/math.c` -> `js_mypackage_math_use`
|
||||||
- `gitea.pockle.world/john/lib/render.c` → `js_gitea_pockle_world_john_lib_render_use`
|
- `gitea.pockle.world/john/lib/render.c` -> `js_gitea_pockle_world_john_lib_render_use`
|
||||||
|
|
||||||
## Required Headers
|
## Required Headers
|
||||||
|
|
||||||
Include `cell.h` for all Cell integration:
|
Include `cell.h` for all ƿit integration:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#include "cell.h"
|
#include "cell.h"
|
||||||
@@ -63,7 +68,7 @@ This provides:
|
|||||||
|
|
||||||
## Conversion Functions
|
## Conversion Functions
|
||||||
|
|
||||||
### JavaScript ↔ C
|
### JavaScript <-> C
|
||||||
|
|
||||||
```c
|
```c
|
||||||
// Numbers
|
// Numbers
|
||||||
@@ -201,7 +206,7 @@ static const JSCFunctionListEntry js_funcs[] = {
|
|||||||
CELL_USE_FUNCS(js_funcs)
|
CELL_USE_FUNCS(js_funcs)
|
||||||
```
|
```
|
||||||
|
|
||||||
Usage in Cell:
|
Usage in ƿit:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var vector = use('vector')
|
var vector = use('vector')
|
||||||
@@ -211,7 +216,7 @@ var n = vector.normalize(3, 4) // {x: 0.6, y: 0.8}
|
|||||||
var d = vector.dot(1, 0, 0, 1) // 0
|
var d = vector.dot(1, 0, 0, 1) // 0
|
||||||
```
|
```
|
||||||
|
|
||||||
## Combining C and Cell
|
## Combining C and ƿit
|
||||||
|
|
||||||
A common pattern is to have a C file provide low-level functions and a `.cm` file provide a higher-level API:
|
A common pattern is to have a C file provide low-level functions and a `.cm` file provide a higher-level API:
|
||||||
|
|
||||||
@@ -244,11 +249,11 @@ return Vector
|
|||||||
C files are automatically compiled when you run:
|
C files are automatically compiled when you run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell build
|
pit build
|
||||||
cell update
|
pit update
|
||||||
```
|
```
|
||||||
|
|
||||||
The resulting dynamic library is placed in `~/.cell/lib/`.
|
The resulting dynamic library is placed in `~/.pit/lib/`.
|
||||||
|
|
||||||
## Platform-Specific Code
|
## Platform-Specific Code
|
||||||
|
|
||||||
@@ -260,7 +265,7 @@ audio_playdate.c # Playdate
|
|||||||
audio_emscripten.c # Web/Emscripten
|
audio_emscripten.c # Web/Emscripten
|
||||||
```
|
```
|
||||||
|
|
||||||
Cell selects the appropriate file based on the target platform.
|
ƿit selects the appropriate file based on the target platform.
|
||||||
|
|
||||||
## Static Declarations
|
## Static Declarations
|
||||||
|
|
||||||
|
|||||||
105
docs/cli.md
105
docs/cli.md
@@ -1,138 +1,143 @@
|
|||||||
# Command Line Interface
|
---
|
||||||
|
title: "Command Line Interface"
|
||||||
|
description: "The pit tool"
|
||||||
|
weight: 40
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Cell provides a command-line interface for managing packages, running scripts, and building applications.
|
ƿit provides a command-line interface for managing packages, running scripts, and building applications.
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell <command> [arguments]
|
pit <command> [arguments]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
### cell version
|
### pit version
|
||||||
|
|
||||||
Display the Cell version.
|
Display the ƿit version.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell version
|
pit version
|
||||||
# 0.1.0
|
# 0.1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell install
|
### pit install
|
||||||
|
|
||||||
Install a package to the shop.
|
Install a package to the shop.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell install gitea.pockle.world/john/prosperon
|
pit install gitea.pockle.world/john/prosperon
|
||||||
cell install /Users/john/local/mypackage # local path
|
pit install /Users/john/local/mypackage # local path
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell update
|
### pit update
|
||||||
|
|
||||||
Update packages from remote sources.
|
Update packages from remote sources.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell update # update all packages
|
pit update # update all packages
|
||||||
cell update <package> # update specific package
|
pit update <package> # update specific package
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell remove
|
### pit remove
|
||||||
|
|
||||||
Remove a package from the shop.
|
Remove a package from the shop.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell remove gitea.pockle.world/john/oldpackage
|
pit remove gitea.pockle.world/john/oldpackage
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell list
|
### pit list
|
||||||
|
|
||||||
List installed packages.
|
List installed packages.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell list # list all installed packages
|
pit list # list all installed packages
|
||||||
cell list <package> # list dependencies of a package
|
pit list <package> # list dependencies of a package
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell ls
|
### pit ls
|
||||||
|
|
||||||
List modules and actors in a package.
|
List modules and actors in a package.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell ls # list files in current project
|
pit ls # list files in current project
|
||||||
cell ls <package> # list files in specified package
|
pit ls <package> # list files in specified package
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell build
|
### pit build
|
||||||
|
|
||||||
Build the current package.
|
Build the current package.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell build
|
pit build
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell test
|
### pit test
|
||||||
|
|
||||||
Run tests.
|
Run tests.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell test # run tests in current package
|
pit test # run tests in current package
|
||||||
cell test all # run all tests
|
pit test all # run all tests
|
||||||
cell test <package> # run tests in specific package
|
pit test <package> # run tests in specific package
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell link
|
### pit link
|
||||||
|
|
||||||
Manage local package links for development.
|
Manage local package links for development.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell link add <canonical> <local_path> # link a package
|
pit link add <canonical> <local_path> # link a package
|
||||||
cell link list # show all links
|
pit link list # show all links
|
||||||
cell link delete <canonical> # remove a link
|
pit link delete <canonical> # remove a link
|
||||||
cell link clear # remove all links
|
pit link clear # remove all links
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell fetch
|
### pit fetch
|
||||||
|
|
||||||
Fetch package sources without extracting.
|
Fetch package sources without extracting.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell fetch <package>
|
pit fetch <package>
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell upgrade
|
### pit upgrade
|
||||||
|
|
||||||
Upgrade the Cell installation itself.
|
Upgrade the ƿit installation itself.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell upgrade
|
pit upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell clean
|
### pit clean
|
||||||
|
|
||||||
Clean build artifacts.
|
Clean build artifacts.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell clean
|
pit clean
|
||||||
```
|
```
|
||||||
|
|
||||||
### cell help
|
### pit help
|
||||||
|
|
||||||
Display help information.
|
Display help information.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell help
|
pit help
|
||||||
cell help <command>
|
pit help <command>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running Scripts
|
## Running Scripts
|
||||||
|
|
||||||
Any `.ce` file in the Cell core can be run as a command:
|
Any `.ce` file in the ƿit core can be run as a command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell version # runs version.ce
|
pit version # runs version.ce
|
||||||
cell build # runs build.ce
|
pit build # runs build.ce
|
||||||
cell test # runs test.ce
|
pit test # runs test.ce
|
||||||
```
|
```
|
||||||
|
|
||||||
## Package Locators
|
## Package Locators
|
||||||
@@ -143,16 +148,16 @@ Packages are identified by locators:
|
|||||||
- **Local**: `/absolute/path/to/package`
|
- **Local**: `/absolute/path/to/package`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cell install gitea.pockle.world/john/prosperon
|
pit install gitea.pockle.world/john/prosperon
|
||||||
cell install /Users/john/work/mylib
|
pit install /Users/john/work/mylib
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Cell stores its data in `~/.cell/`:
|
ƿit stores its data in `~/.pit/`:
|
||||||
|
|
||||||
```
|
```
|
||||||
~/.cell/
|
~/.pit/
|
||||||
├── packages/ # installed packages
|
├── packages/ # installed packages
|
||||||
├── lib/ # compiled dynamic libraries
|
├── lib/ # compiled dynamic libraries
|
||||||
├── build/ # build cache
|
├── build/ # build cache
|
||||||
@@ -163,7 +168,7 @@ Cell stores its data in `~/.cell/`:
|
|||||||
|
|
||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
Cell reads the `HOME` environment variable to locate the shop directory.
|
ƿit reads the `HOME` environment variable to locate the shop directory.
|
||||||
|
|
||||||
## Exit Codes
|
## Exit Codes
|
||||||
|
|
||||||
|
|||||||
1044
docs/functions.md
1044
docs/functions.md
File diff suppressed because it is too large
Load Diff
@@ -1,66 +0,0 @@
|
|||||||
# Cell
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Cell is an actor-based scripting language for building concurrent applications. It combines a familiar C-like syntax with the actor model of computation, optimized for low memory usage and simplicity.
|
|
||||||
|
|
||||||
## Key Features
|
|
||||||
|
|
||||||
- **Actor Model** — isolated memory, message passing, no shared state
|
|
||||||
- **Immutability** — `stone()` makes values permanently frozen
|
|
||||||
- **Prototype Inheritance** — objects without classes
|
|
||||||
- **C Integration** — seamlessly extend with native code
|
|
||||||
- **Cross-Platform** — deploy to desktop, web, and embedded
|
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// hello.ce - A simple actor
|
|
||||||
log.console("Hello, Cell!")
|
|
||||||
$stop()
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cell hello
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
- [**Cell Language**](cellscript.md) — syntax, types, and built-in functions
|
|
||||||
- [**Actors and Modules**](actors.md) — the execution model
|
|
||||||
- [**Packages**](packages.md) — code organization and sharing
|
|
||||||
- [**Command Line**](cli.md) — the `cell` tool
|
|
||||||
- [**Writing C Modules**](c-modules.md) — native extensions
|
|
||||||
|
|
||||||
## Standard Library
|
|
||||||
|
|
||||||
- [text](library/text.md) — string manipulation
|
|
||||||
- [number](library/number.md) — numeric operations (functions are global: `floor()`, `max()`, etc.)
|
|
||||||
- [array](library/array.md) — array utilities
|
|
||||||
- [object](library/object.md) — object utilities
|
|
||||||
- [blob](library/blob.md) — binary data
|
|
||||||
- [time](library/time.md) — time and dates
|
|
||||||
- [math](library/math.md) — trigonometry and math
|
|
||||||
- [json](library/json.md) — JSON encoding/decoding
|
|
||||||
- [random](library/random.md) — random numbers
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
Cell programs are organized into **packages**. Each package contains:
|
|
||||||
|
|
||||||
- **Modules** (`.cm`) — return a value, cached and frozen
|
|
||||||
- **Actors** (`.ce`) — run independently, communicate via messages
|
|
||||||
- **C files** (`.c`) — compiled to native libraries
|
|
||||||
|
|
||||||
Actors never share memory. They communicate by sending messages, which are automatically serialized. This makes concurrent programming safe and predictable.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Clone and bootstrap
|
|
||||||
git clone https://gitea.pockle.world/john/cell
|
|
||||||
cd cell
|
|
||||||
make bootstrap
|
|
||||||
```
|
|
||||||
|
|
||||||
The Cell shop is stored at `~/.cell/`.
|
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
# Cell Language
|
---
|
||||||
|
title: "ƿit Language"
|
||||||
|
description: "Syntax, types, operators, and built-in functions"
|
||||||
|
weight: 10
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Cell is a scripting language for actor-based programming. It combines a familiar syntax with a prototype-based object system and strict immutability semantics.
|
ƿit is a scripting language for actor-based programming. It combines a familiar syntax with a prototype-based object system and strict immutability semantics.
|
||||||
|
|
||||||
## Basics
|
## Basics
|
||||||
|
|
||||||
@@ -13,7 +18,7 @@ def PI = 3.14159 // constant (cannot be reassigned)
|
|||||||
|
|
||||||
### Data Types
|
### Data Types
|
||||||
|
|
||||||
Cell has six fundamental types:
|
ƿit has six fundamental types:
|
||||||
|
|
||||||
- **number** — DEC64 decimal floating point (no rounding errors)
|
- **number** — DEC64 decimal floating point (no rounding errors)
|
||||||
- **text** — Unicode strings
|
- **text** — Unicode strings
|
||||||
@@ -49,7 +54,7 @@ null
|
|||||||
["a", "b", "c"]
|
["a", "b", "c"]
|
||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
{name: "cell", version: 1}
|
{name: "pit", version: 1}
|
||||||
{x: 10, y: 20}
|
{x: 10, y: 20}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -108,7 +113,7 @@ while (condition) {
|
|||||||
break
|
break
|
||||||
continue
|
continue
|
||||||
return value
|
return value
|
||||||
throw "error message"
|
disrupt
|
||||||
```
|
```
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
@@ -266,7 +271,7 @@ log.error("problem") // error output
|
|||||||
|
|
||||||
## Pattern Matching
|
## Pattern Matching
|
||||||
|
|
||||||
Cell supports regex patterns in string functions, but not standalone regex objects.
|
ƿit supports regex patterns in string functions, but not standalone regex objects.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
text.search("hello world", /world/)
|
text.search("hello world", /world/)
|
||||||
@@ -275,14 +280,32 @@ replace("hello", /l/g, "L")
|
|||||||
|
|
||||||
## Error Handling
|
## Error Handling
|
||||||
|
|
||||||
```javascript
|
ƿit uses `disrupt` and `disruption` for error handling. A `disrupt` signals that something went wrong. The `disruption` block attached to a function catches it.
|
||||||
try {
|
|
||||||
riskyOperation()
|
|
||||||
} catch (e) {
|
|
||||||
log.error(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
throw "something went wrong"
|
```javascript
|
||||||
|
var safe_divide = function(a, b) {
|
||||||
|
if (b == 0) disrupt
|
||||||
|
return a / b
|
||||||
|
} disruption {
|
||||||
|
log.error("something went wrong")
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
If an actor has an uncaught error, it crashes.
|
`disrupt` is a bare keyword — it does not carry a value. The `disruption` block knows that something went wrong, but not what.
|
||||||
|
|
||||||
|
To test whether an operation disrupts:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var should_disrupt = function(fn) {
|
||||||
|
var caught = false
|
||||||
|
var wrapper = function() {
|
||||||
|
fn()
|
||||||
|
} disruption {
|
||||||
|
caught = true
|
||||||
|
}
|
||||||
|
wrapper()
|
||||||
|
return caught
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If an actor has an unhandled disruption, it crashes.
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
nav:
|
|
||||||
- text.md
|
|
||||||
- number.md
|
|
||||||
- array.md
|
|
||||||
- object.md
|
|
||||||
- blob.md
|
|
||||||
- time.md
|
|
||||||
- math.md
|
|
||||||
- json.md
|
|
||||||
- random.md
|
|
||||||
22
docs/library/_index.md
Normal file
22
docs/library/_index.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
title: "Standard Library"
|
||||||
|
description: "ƿit standard library modules"
|
||||||
|
weight: 90
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
|
ƿit includes a standard library of modules loaded with `use()`.
|
||||||
|
|
||||||
|
| Module | Description |
|
||||||
|
|--------|-------------|
|
||||||
|
| [text](/docs/library/text/) | String conversion and manipulation |
|
||||||
|
| [number](/docs/library/number/) | Numeric conversion and operations |
|
||||||
|
| [array](/docs/library/array/) | Array creation and manipulation |
|
||||||
|
| [object](/docs/library/object/) | Object creation and manipulation |
|
||||||
|
| [blob](/docs/library/blob/) | Binary data (bits, not bytes) |
|
||||||
|
| [time](/docs/library/time/) | Time constants and conversions |
|
||||||
|
| [math](/docs/library/math/) | Trigonometry, logarithms, roots |
|
||||||
|
| [json](/docs/library/json/) | JSON encoding and decoding |
|
||||||
|
| [random](/docs/library/random/) | Random number generation |
|
||||||
|
|
||||||
|
Most numeric functions (`floor`, `max`, `abs`, etc.) are global intrinsics and do not require `use`. See [Built-in Functions](/docs/functions/) for the full list.
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
# array
|
---
|
||||||
|
title: "array"
|
||||||
|
description: "Array creation and manipulation"
|
||||||
|
weight: 30
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
The `array` function and its methods handle array creation and manipulation.
|
The `array` function and its methods handle array creation and manipulation.
|
||||||
|
|
||||||
@@ -60,7 +65,6 @@ Split text into grapheme clusters.
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
array("hello") // ["h", "e", "l", "l", "o"]
|
array("hello") // ["h", "e", "l", "l", "o"]
|
||||||
array("👨👩👧") // ["👨👩👧"]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### array(text, separator)
|
### array(text, separator)
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# blob
|
---
|
||||||
|
title: "blob"
|
||||||
|
description: "Binary data containers (bits, not bytes)"
|
||||||
|
weight: 50
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Blobs are binary large objects — containers of bits (not bytes). They're used for encoding data, messages, images, network payloads, and more.
|
Blobs are binary large objects — containers of bits (not bytes). They're used for encoding data, messages, images, network payloads, and more.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# json
|
---
|
||||||
|
title: "json"
|
||||||
|
description: "JSON encoding and decoding"
|
||||||
|
weight: 80
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
JSON encoding and decoding.
|
JSON encoding and decoding.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
# math
|
---
|
||||||
|
title: "math"
|
||||||
|
description: "Trigonometry, logarithms, and roots"
|
||||||
|
weight: 70
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Cell provides three math modules with identical functions but different angle representations:
|
ƿit provides three math modules with identical functions but different angle representations:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var math = use('math/radians') // angles in radians
|
var math = use('math/radians') // angles in radians
|
||||||
@@ -35,7 +40,7 @@ math.tangent(math.pi / 4) // 1 (radians)
|
|||||||
Inverse sine.
|
Inverse sine.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
math.arc_sine(1) // π/2 (radians)
|
math.arc_sine(1) // pi/2 (radians)
|
||||||
```
|
```
|
||||||
|
|
||||||
### arc_cosine(n)
|
### arc_cosine(n)
|
||||||
@@ -43,7 +48,7 @@ math.arc_sine(1) // π/2 (radians)
|
|||||||
Inverse cosine.
|
Inverse cosine.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
math.arc_cosine(0) // π/2 (radians)
|
math.arc_cosine(0) // pi/2 (radians)
|
||||||
```
|
```
|
||||||
|
|
||||||
### arc_tangent(n, denominator)
|
### arc_tangent(n, denominator)
|
||||||
@@ -51,9 +56,9 @@ math.arc_cosine(0) // π/2 (radians)
|
|||||||
Inverse tangent. With two arguments, computes atan2.
|
Inverse tangent. With two arguments, computes atan2.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
math.arc_tangent(1) // π/4 (radians)
|
math.arc_tangent(1) // pi/4 (radians)
|
||||||
math.arc_tangent(1, 1) // π/4 (radians)
|
math.arc_tangent(1, 1) // pi/4 (radians)
|
||||||
math.arc_tangent(-1, -1) // -3π/4 (radians)
|
math.arc_tangent(-1, -1) // -3pi/4 (radians)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Exponentials and Logarithms
|
## Exponentials and Logarithms
|
||||||
@@ -64,7 +69,7 @@ Euler's number raised to a power. Default power is 1.
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
math.e() // 2.718281828...
|
math.e() // 2.718281828...
|
||||||
math.e(2) // e²
|
math.e(2) // e^2
|
||||||
```
|
```
|
||||||
|
|
||||||
### ln(n)
|
### ln(n)
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# number
|
---
|
||||||
|
title: "number"
|
||||||
|
description: "Numeric conversion and operations"
|
||||||
|
weight: 20
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
The `number` function and its methods handle numeric conversion and operations.
|
The `number` function and its methods handle numeric conversion and operations.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# object
|
---
|
||||||
|
title: "object"
|
||||||
|
description: "Object creation and manipulation"
|
||||||
|
weight: 40
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
The `object` function and related utilities handle object creation and manipulation.
|
The `object` function and related utilities handle object creation and manipulation.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# random
|
---
|
||||||
|
title: "random"
|
||||||
|
description: "Random number generation"
|
||||||
|
weight: 90
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Random number generation.
|
Random number generation.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# text
|
---
|
||||||
|
title: "text"
|
||||||
|
description: "String conversion and manipulation"
|
||||||
|
weight: 10
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
The `text` function and its methods handle string conversion and manipulation.
|
The `text` function and its methods handle string conversion and manipulation.
|
||||||
|
|
||||||
@@ -101,7 +106,7 @@ text.format("{0} + {1} = {2}", [1, 2, 3])
|
|||||||
Unicode normalize the text (NFC form).
|
Unicode normalize the text (NFC form).
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
text.normalize("café") // normalized form
|
text.normalize("cafe\u0301") // normalized form
|
||||||
```
|
```
|
||||||
|
|
||||||
### text.codepoint(text)
|
### text.codepoint(text)
|
||||||
@@ -110,7 +115,6 @@ Get the Unicode codepoint of the first character.
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
text.codepoint("A") // 65
|
text.codepoint("A") // 65
|
||||||
text.codepoint("😀") // 128512
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### text.extract(text, pattern, from, to)
|
### text.extract(text, pattern, from, to)
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
# time
|
---
|
||||||
|
title: "time"
|
||||||
|
description: "Time constants and conversion functions"
|
||||||
|
weight: 60
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
The time module provides time constants and conversion functions.
|
The time module provides time constants and conversion functions.
|
||||||
|
|
||||||
|
|||||||
248
docs/memory.md
248
docs/memory.md
@@ -1,248 +0,0 @@
|
|||||||
# Cell actor scripting language
|
|
||||||
|
|
||||||
Cell is a Misty [https://mistysystem.com](https://mistysystem.com) implementation.
|
|
||||||
|
|
||||||
## Memory
|
|
||||||
Values are 32 bit for 32 bit builds and 64 bit for 64 bit builds.
|
|
||||||
|
|
||||||
### 32 bit value
|
|
||||||
|
|
||||||
LSB = 0
|
|
||||||
payload is a 31 bit signed int
|
|
||||||
|
|
||||||
LSB = 01
|
|
||||||
payload is a 30 bit pointer
|
|
||||||
|
|
||||||
LSB = 11
|
|
||||||
next 3 bits = special tag. 27 bits of payload.
|
|
||||||
|
|
||||||
### 64 bit value
|
|
||||||
LSB = 0
|
|
||||||
payload is a 32 bit signed int, using high 32 bits
|
|
||||||
|
|
||||||
LSB = 01
|
|
||||||
payload is a 61 bit pointer
|
|
||||||
|
|
||||||
LSB = 101
|
|
||||||
Short float: a 61 bit double, with 3 less exponent bits
|
|
||||||
|
|
||||||
LSB = 11
|
|
||||||
Special tag: next 3 bits. 5 bits total. 59 bits of payload. 8 total special tags.
|
|
||||||
|
|
||||||
Special tags:
|
|
||||||
1: Bool. Payload is 0 or 1.
|
|
||||||
2: null. payload is 0.
|
|
||||||
3: exception.
|
|
||||||
4: string.
|
|
||||||
Immediate string. Next 3 low bits = length in bytes. Rest is string data. This allows for strings up to 7 ascii letters. Encoded in utf8.
|
|
||||||
|
|
||||||
## Numbers and math
|
|
||||||
Cell can be compiled with different levels of exactness for numeracy. Any number which cannot be represented exactly becomes "null". Any numeric operation which includes "null" results in "null".
|
|
||||||
|
|
||||||
Using short floats in a 64 bit system means you have doubles in the range of +- 10^38, not the full range of double. If you create a number out of that range, it's null.
|
|
||||||
|
|
||||||
You can also compile a 64 bit system with full precision doubles, but this will use more memory and may be slower.
|
|
||||||
|
|
||||||
You can also compile a 64 bit system with 32 bit floats, stored as a 32 bit int is. Again, out of the 32 bit float range = null.
|
|
||||||
|
|
||||||
You can compile without floating point support at all; 32 bit ints are then used for fixed point calculations.
|
|
||||||
|
|
||||||
Or, you can compile using Dec64, which is a 64 bit decimal floating point format, for exact precision.
|
|
||||||
|
|
||||||
## Objects
|
|
||||||
Objects are heap allocated, referenced by a pointer value. They are all preceded by an object header, the length of a word on the system.
|
|
||||||
|
|
||||||
### 64 bit build
|
|
||||||
56 bits capacity
|
|
||||||
1 bit memory reclamation flag: note that this obj has already been moved
|
|
||||||
2 bit reserved (per object)
|
|
||||||
1 bit stone: note that this obj is immutable
|
|
||||||
3 bit type: note the type of the object
|
|
||||||
1 bit: fwd: note that this obj is a forward linkage
|
|
||||||
|
|
||||||
Last bit ..1:
|
|
||||||
The forward type indicates that the object (an array, blob, pretext, or record) has grown beyond its capacity and is now residing at a new address. The remaining 63 bits contain the address of the enlarged object. Forward linkages are cleaned up by the memory reclaimer.
|
|
||||||
|
|
||||||
Type 7: C light C object
|
|
||||||
|
|
||||||
Header
|
|
||||||
Pointer
|
|
||||||
|
|
||||||
Capacity is an ID of a registered C type.
|
|
||||||
Pointer is a pointer to the opaque C object.
|
|
||||||
|
|
||||||
Type 0: Array
|
|
||||||
Header
|
|
||||||
Length
|
|
||||||
Element[]
|
|
||||||
|
|
||||||
Capacity is number of elements the array can hold. Length is number of elements in use. Number of words used by an array is capacity + 2.
|
|
||||||
|
|
||||||
Type 1: blob
|
|
||||||
Header
|
|
||||||
Length
|
|
||||||
Bit[]
|
|
||||||
Capacity is number of bits the blob can hold. Length is number of bits in use. Bits follow, from [0] to [capacity - 1], with [0] bit in the most significant position of word 2, and [63] in the least significant position of word 2. The last word is zero filled, if necessary.
|
|
||||||
|
|
||||||
Number of words used is (capacity + 63) // 64 + 2
|
|
||||||
|
|
||||||
Type 2: Text
|
|
||||||
Text has two forms, depending on if it is stone or not, which changes the meaning of its length word.
|
|
||||||
|
|
||||||
Header
|
|
||||||
Length(pretext) or Hash(text)
|
|
||||||
Character[0] and character[1]
|
|
||||||
|
|
||||||
Capacity of pretex is the number of characters it can hold. During stoning and reclamation, capacity is set to the length.
|
|
||||||
|
|
||||||
The capacity of a text is its length.
|
|
||||||
|
|
||||||
The length of a pretext is the number of characters it contains; it is not greater than the capacity.
|
|
||||||
|
|
||||||
Hash of a text is used for organizing records. If the hash is zero, it's not been computed yet. All texts in the immutable memory have hashes.
|
|
||||||
|
|
||||||
A text object contains UTF32 characters, packed two per word. If the number of characters is odd, the least significant half of the last word is zero filled.
|
|
||||||
|
|
||||||
The number of words used by a text is (capacity + 1) // 2 + 2
|
|
||||||
|
|
||||||
Type 3: Record
|
|
||||||
|
|
||||||
A record is an array of fields represented as key/value pairs. Fields are located by hashes of texts, using open addressing with linear probing and lazy deletion. The load factor is less than 0.5.
|
|
||||||
|
|
||||||
Header
|
|
||||||
Prototype
|
|
||||||
Length
|
|
||||||
Key[0]
|
|
||||||
Value[0]
|
|
||||||
Key[1]
|
|
||||||
Value[1]
|
|
||||||
...
|
|
||||||
|
|
||||||
The capacity is the number of fields the record can hold. It is a power of two minus one. It is at least twice the length.
|
|
||||||
|
|
||||||
The length is the number of fields that the record currently contains.
|
|
||||||
|
|
||||||
A field candidate number is identified by and(key.hash, capacity). In case of hash collision, advance to the next field. If this goes past the end, continue with field 1. Field 0 is reserved.
|
|
||||||
|
|
||||||
The "exception" special tag is used to mark deleted entries in the object map.
|
|
||||||
|
|
||||||
The number of words used by a record is (capacity + 1) * 2.
|
|
||||||
|
|
||||||
Prototypes are searched for for properties if one cannot be found on the record itself. Prototypes can have prototypes.
|
|
||||||
|
|
||||||
#### key[0] and value[0]
|
|
||||||
These are reserved for internal use, and skipped over during key probing.
|
|
||||||
|
|
||||||
The first 32 bits of key are used as a 32 bit integer key, if this object has ever been used as a key itself.
|
|
||||||
|
|
||||||
The last 32 bits are used as an opaque C class key. C types can be registered with the system, and each are assigned a monotonically increasing number. In the case that this object has a C type, then the bottom 32 bits of key[0] are not 0. If that is the case, then a pointer to its C object is stored in value[0].
|
|
||||||
|
|
||||||
#### Valid keys & Hashing
|
|
||||||
Keys are stored directly in object maps. There are three possibilities for a vaild key: an object text, an object record, or an immediate text.
|
|
||||||
|
|
||||||
In the case of an immediate text, the hash is computed on the fly using the fash64_hash_one function, before being used to look up the key in the object map. Direct value comparison is used to confirm the key.
|
|
||||||
|
|
||||||
For object texts (texts longer than 7 ascii chars), the hash is stored in the text object itself. When an object text is used as a key, a stone version is created and interned. Any program static texts reference this stoned, interned text. When looking up a heap text as a key, it is first discovered if it's in the interned table. If it's not, the key is not in the object (since all keys are interned). If it is, the interned version is returned to check against the object map. The hash of the interned text is used to look up the key in the object map, and then direct pointer comparison is used to confirm the key.
|
|
||||||
|
|
||||||
For record keys, these are unique; once a record is used as a key, it gets assigned a monotonically increasing 32 bit integer, stored in key[0]. When checking it in an object map, the integer is used directly as the key. If key[0] is 0, the record has not been used as a key yet. If it's not 0, fash64_hash_one is used to compute a hash of its ID, and then direct value pointer comparison is used to confirm.
|
|
||||||
|
|
||||||
### Text interning
|
|
||||||
Texts that cannot fit in an immediate, and which are used as an object key, create a stoned and interned version (the pointer which is used as the key). Any text literals are also stoned and interned.
|
|
||||||
|
|
||||||
The interning table is an open addressed hash, with a load of 0.8, using a robin hood value. Probing is done using the text hash, confirmation is done using length, and then memcmp of the text.
|
|
||||||
|
|
||||||
When the GC run, a new interned text table is created. Each text literal, and each text used as a key, is added to the new table, as the live objects are copied. This keeps the interning table from becoming a graveyard. Interned values are never deleted until a GC.
|
|
||||||
|
|
||||||
Type 4: Function
|
|
||||||
|
|
||||||
Header
|
|
||||||
Code
|
|
||||||
Outer
|
|
||||||
A function object has zero capacity and is always stone.
|
|
||||||
|
|
||||||
Code is a pointer to the code object that the function executes.
|
|
||||||
|
|
||||||
Outer is a pointer to the frame that created this function object.
|
|
||||||
|
|
||||||
Size is 3 words.
|
|
||||||
|
|
||||||
Type 5: Frame
|
|
||||||
|
|
||||||
Header
|
|
||||||
Function
|
|
||||||
Caller
|
|
||||||
Return address
|
|
||||||
|
|
||||||
The activation frame is created when a function is invoked to hold its linkages and state.
|
|
||||||
|
|
||||||
The capacity is the number of slots, including the inputs, variables, temporaries, and the four words of overhead. A frame, unlike the other types, is never stone.
|
|
||||||
|
|
||||||
The function is the address of the function object being called.
|
|
||||||
|
|
||||||
The caller is the address of the frame that is invoking the function.
|
|
||||||
|
|
||||||
The return address is the address of the instruction in the code that should be executed upon return.
|
|
||||||
|
|
||||||
Next come the input arguments, if any.
|
|
||||||
|
|
||||||
Then the variables closed over by the inner functions.
|
|
||||||
|
|
||||||
Then the variables that are not closed over, followed by the temporaries.
|
|
||||||
|
|
||||||
When a function returns, the caller is set to zero. This is a signal to the memory reclaimer that the frame can be reduced.
|
|
||||||
|
|
||||||
Type 6: Code
|
|
||||||
|
|
||||||
Header
|
|
||||||
Arity
|
|
||||||
Size
|
|
||||||
Closure size
|
|
||||||
Entry point
|
|
||||||
Disruption point
|
|
||||||
|
|
||||||
A code object exists in the actor's immutable memory. A code object never exists in mutable memory.
|
|
||||||
|
|
||||||
A code object has a zero capacity and is always stone.
|
|
||||||
|
|
||||||
The arity is the maximum number of inputs.
|
|
||||||
|
|
||||||
The size is the capacity of an activation frame that will execute this code.
|
|
||||||
|
|
||||||
The closure size is a reduced capacity for returned frames that survive memory reclamation.
|
|
||||||
|
|
||||||
The entry point is the address at which to begin execution.
|
|
||||||
|
|
||||||
The disruption point is the address of the disruption clause.
|
|
||||||
|
|
||||||
### opaque C objects
|
|
||||||
Records can have opaque C data attached to them.
|
|
||||||
|
|
||||||
A C class can register a GC clean up, and a GC trace function. The trace function is called when the record is encountered in the live object graph; and it should mark any values it wants to keep alive in that function.
|
|
||||||
|
|
||||||
The system maintains an array of live opaque C objects. When such an object is encountered, it marks it as live in the array. When the GC completes, it iterates this array and calls the GC clean up function for each C object in the array with alive=0. Alive is then cleared for the next GC cycle.
|
|
||||||
|
|
||||||
## 32 bit build
|
|
||||||
~3 bit type
|
|
||||||
1 bit stone
|
|
||||||
1 bit memory reclamation flag
|
|
||||||
27 bit capacity
|
|
||||||
|
|
||||||
Key differences here are
|
|
||||||
|
|
||||||
blob max capacity is 2**27 bits = 2**24 bytes = 16 MB [this likely needs addressed]
|
|
||||||
|
|
||||||
fwd is type ...0, and the pointer is 31 bits
|
|
||||||
other types are
|
|
||||||
111 array
|
|
||||||
101 object
|
|
||||||
011 blob
|
|
||||||
001
|
|
||||||
|
|
||||||
## Memory
|
|
||||||
Cell uses a single block of memory that it doles out as needed to the actors in its system.
|
|
||||||
|
|
||||||
Actors are given a block of memory in standard sizes using a doubling buddy memory manager. An actor is given an immutable data section on birth, as well as a mutable data section. When its mutable data becomes full, it requests a new one. Actors utilize their mutable memory with a simple bump allocation. If there is not sufficient memory available, the actor suspends and its status changes to exhausted.
|
|
||||||
|
|
||||||
The smallest block size is determined per platform, but it can be as small as 4KB on 64 bit systems.
|
|
||||||
|
|
||||||
The actor is then given a new block of memory of the same size, and it runs a garbage collector to reclaim memory. It uses the cheney copying algorithm. If a disappointing amount of memory was reclaimed, it is noted, and the actor is given a larger block of memory on the next request.
|
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
# Packages
|
---
|
||||||
|
title: "Packages"
|
||||||
|
description: "Code organization and sharing in ƿit"
|
||||||
|
weight: 30
|
||||||
|
type: "docs"
|
||||||
|
---
|
||||||
|
|
||||||
Packages are the fundamental unit of code organization and sharing in Cell.
|
Packages are the fundamental unit of code organization and sharing in ƿit.
|
||||||
|
|
||||||
## Package Structure
|
## Package Structure
|
||||||
|
|
||||||
A package is a directory containing a `cell.toml` manifest:
|
A package is a directory containing a `pit.toml` manifest:
|
||||||
|
|
||||||
```
|
```
|
||||||
mypackage/
|
mypackage/
|
||||||
├── cell.toml # package manifest
|
├── pit.toml # package manifest
|
||||||
├── main.ce # entry point (optional)
|
├── main.ce # entry point (optional)
|
||||||
├── utils.cm # module
|
├── utils.cm # module
|
||||||
├── helper/
|
├── helper/
|
||||||
@@ -17,7 +22,7 @@ mypackage/
|
|||||||
└── _internal.cm # private module (underscore prefix)
|
└── _internal.cm # private module (underscore prefix)
|
||||||
```
|
```
|
||||||
|
|
||||||
## cell.toml
|
## pit.toml
|
||||||
|
|
||||||
The package manifest declares metadata and dependencies:
|
The package manifest declares metadata and dependencies:
|
||||||
|
|
||||||
@@ -38,11 +43,11 @@ mylib = "/Users/john/work/mylib"
|
|||||||
|
|
||||||
## Module Resolution
|
## Module Resolution
|
||||||
|
|
||||||
When importing with `use()`, Cell searches in order:
|
When importing with `use()`, ƿit searches in order:
|
||||||
|
|
||||||
1. **Local package** — relative to package root
|
1. **Local package** — relative to package root
|
||||||
2. **Dependencies** — via aliases in `cell.toml`
|
2. **Dependencies** — via aliases in `pit.toml`
|
||||||
3. **Core** — built-in Cell modules
|
3. **Core** — built-in ƿit modules
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// In package 'myapp' with dependency: renderer = "gitea.pockle.world/john/renderer"
|
// In package 'myapp' with dependency: renderer = "gitea.pockle.world/john/renderer"
|
||||||
@@ -85,10 +90,10 @@ Local packages are symlinked into the shop, making development seamless.
|
|||||||
|
|
||||||
## The Shop
|
## The Shop
|
||||||
|
|
||||||
Cell stores all packages in the **shop** at `~/.cell/`:
|
ƿit stores all packages in the **shop** at `~/.pit/`:
|
||||||
|
|
||||||
```
|
```
|
||||||
~/.cell/
|
~/.pit/
|
||||||
├── packages/
|
├── packages/
|
||||||
│ ├── core -> gitea.pockle.world/john/cell
|
│ ├── core -> gitea.pockle.world/john/cell
|
||||||
│ ├── gitea.pockle.world/
|
│ ├── gitea.pockle.world/
|
||||||
@@ -134,20 +139,20 @@ target = "/Users/john/work/prosperon"
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install from remote
|
# Install from remote
|
||||||
cell install gitea.pockle.world/john/prosperon
|
pit install gitea.pockle.world/john/prosperon
|
||||||
|
|
||||||
# Install from local path
|
# Install from local path
|
||||||
cell install /Users/john/work/mylib
|
pit install /Users/john/work/mylib
|
||||||
```
|
```
|
||||||
|
|
||||||
## Updating Packages
|
## Updating Packages
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Update all
|
# Update all
|
||||||
cell update
|
pit update
|
||||||
|
|
||||||
# Update specific package
|
# Update specific package
|
||||||
cell update gitea.pockle.world/john/prosperon
|
pit update gitea.pockle.world/john/prosperon
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development Workflow
|
## Development Workflow
|
||||||
@@ -156,12 +161,12 @@ For active development, link packages locally:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Link a package for development
|
# Link a package for development
|
||||||
cell link add gitea.pockle.world/john/prosperon /Users/john/work/prosperon
|
pit link add gitea.pockle.world/john/prosperon /Users/john/work/prosperon
|
||||||
|
|
||||||
# Changes to /Users/john/work/prosperon are immediately visible
|
# Changes to /Users/john/work/prosperon are immediately visible
|
||||||
|
|
||||||
# Remove link when done
|
# Remove link when done
|
||||||
cell link delete gitea.pockle.world/john/prosperon
|
pit link delete gitea.pockle.world/john/prosperon
|
||||||
```
|
```
|
||||||
|
|
||||||
## C Extensions
|
## C Extensions
|
||||||
@@ -170,14 +175,14 @@ C files in a package are compiled into a dynamic library:
|
|||||||
|
|
||||||
```
|
```
|
||||||
mypackage/
|
mypackage/
|
||||||
├── cell.toml
|
├── pit.toml
|
||||||
├── render.c # compiled to mypackage.dylib
|
├── render.c # compiled to mypackage.dylib
|
||||||
└── render.cm # optional Cell wrapper
|
└── render.cm # optional ƿit wrapper
|
||||||
```
|
```
|
||||||
|
|
||||||
The library is named after the package and placed in `~/.cell/lib/`.
|
The library is named after the package and placed in `~/.pit/lib/`.
|
||||||
|
|
||||||
See [Writing C Modules](c-modules.md) for details.
|
See [Writing C Modules](/docs/c-modules/) for details.
|
||||||
|
|
||||||
## Platform-Specific Files
|
## Platform-Specific Files
|
||||||
|
|
||||||
@@ -190,4 +195,4 @@ mypackage/
|
|||||||
└── audio_emscripten.c # Web-specific
|
└── audio_emscripten.c # Web-specific
|
||||||
```
|
```
|
||||||
|
|
||||||
Cell selects the appropriate file based on the build target.
|
ƿit selects the appropriate file based on the build target.
|
||||||
|
|||||||
287
docs/pitcode.md
287
docs/pitcode.md
@@ -1,287 +0,0 @@
|
|||||||
# Pitmachine
|
|
||||||
A pitmachine is an abstract register machine for executing pitcode.
|
|
||||||
|
|
||||||
The pitmachine assembly language is JSON. The instructions field contains an array of labels and instructions. Labels are the targets of branch instructions. They are simple text. Slots are elements in an activation frame. They are designated by a small positive integer. Slots are the general registers of the pitmachine. Slots hold the arguments, variables, and temporaries of a function invocation.
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "program_name",
|
|
||||||
"data": {⸳⸳⸳},
|
|
||||||
"source": "...",
|
|
||||||
The labels record associates labels with tokens for use by debuggers.
|
|
||||||
|
|
||||||
"labels": {
|
|
||||||
"entry": token,
|
|
||||||
"beyond": token,
|
|
||||||
...
|
|
||||||
},
|
|
||||||
The instructions array is a list of instructions and labels.
|
|
||||||
|
|
||||||
instructions: [
|
|
||||||
A statement label:
|
|
||||||
|
|
||||||
"entry",
|
|
||||||
go to beyond:
|
|
||||||
|
|
||||||
["jump", "beyond"],
|
|
||||||
assign slot 8: pi / 2
|
|
||||||
|
|
||||||
["access", 13, {"kind": "name", "name": "pi", "make": "intrinsic", ⸳⸳⸳}],
|
|
||||||
["int", 14, 2],
|
|
||||||
["divide", 8, 13, 14],
|
|
||||||
⸳⸳⸳
|
|
||||||
"beyond"
|
|
||||||
⸳⸳⸳
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
## Pitcode instructions
|
|
||||||
This is a register based machine.
|
|
||||||
|
|
||||||
### Arithmetic
|
|
||||||
Arithmetic instructions perform operations on numbers. All other cases disrupt (except add, which is polymorphic).
|
|
||||||
|
|
||||||
"add", dest, left, right // dest, left, and right are numbers designating slots in the current activation frame. Also works on texts (concatenation).
|
|
||||||
|
|
||||||
"subtract", dest, left, right
|
|
||||||
|
|
||||||
"multiply", dest, left, right
|
|
||||||
|
|
||||||
"divide", dest, left, right
|
|
||||||
|
|
||||||
"integer_divide", dest, left, right
|
|
||||||
|
|
||||||
"modulo", dest, left, right
|
|
||||||
|
|
||||||
"remainder", dest, left, right
|
|
||||||
|
|
||||||
"max", dest, left, right
|
|
||||||
|
|
||||||
"min", dest, left, right
|
|
||||||
|
|
||||||
"abs", dest, right
|
|
||||||
|
|
||||||
"neg", dest, right
|
|
||||||
|
|
||||||
"sign", dest, right
|
|
||||||
|
|
||||||
"fraction", dest, right
|
|
||||||
|
|
||||||
"integer", dest, right
|
|
||||||
|
|
||||||
"ceiling", dest, right, place
|
|
||||||
|
|
||||||
"floor", dest, right, place
|
|
||||||
|
|
||||||
"round", dest, right, place
|
|
||||||
|
|
||||||
"trunc", dest, right, place
|
|
||||||
|
|
||||||
### Text
|
|
||||||
Text instructions perform operations on texts. All other cases disrupt.
|
|
||||||
|
|
||||||
"concat", dest, left, right // concat two texts
|
|
||||||
|
|
||||||
"concat_space", dest, left, right
|
|
||||||
|
|
||||||
"character", dest, right
|
|
||||||
|
|
||||||
"codepoint", dest, right
|
|
||||||
|
|
||||||
"length", dest, right
|
|
||||||
|
|
||||||
"lower", dest, right
|
|
||||||
|
|
||||||
"upper", dest, right
|
|
||||||
|
|
||||||
"append", pretext, right
|
|
||||||
|
|
||||||
Append the right text to the pretext, forwarding and growing its capacity if necessary.
|
|
||||||
|
|
||||||
### Comparison
|
|
||||||
Comparison instructions perform operations on texts or numbers. All other cases disrupt.
|
|
||||||
|
|
||||||
"eq", dest, left, right
|
|
||||||
|
|
||||||
"ne", dest, left, right
|
|
||||||
|
|
||||||
"lt", dest, left, right
|
|
||||||
|
|
||||||
"le", dest, left, right
|
|
||||||
|
|
||||||
"gt", dest, left, right
|
|
||||||
|
|
||||||
"ge", dest, left, right
|
|
||||||
|
|
||||||
### Logical
|
|
||||||
|
|
||||||
"not", dest, right
|
|
||||||
|
|
||||||
### Bitwise
|
|
||||||
Bitwise instructions convert operands to 32-bit integers. Non-numbers disrupt.
|
|
||||||
|
|
||||||
"bitand", dest, left, right
|
|
||||||
|
|
||||||
"bitor", dest, left, right
|
|
||||||
|
|
||||||
"bitxor", dest, left, right
|
|
||||||
|
|
||||||
"bitnot", dest, right
|
|
||||||
|
|
||||||
"shl", dest, left, right
|
|
||||||
|
|
||||||
"shr", dest, left, right
|
|
||||||
|
|
||||||
"ushr", dest, left, right
|
|
||||||
|
|
||||||
### Function
|
|
||||||
|
|
||||||
"frame", dest, func, nr_args
|
|
||||||
|
|
||||||
Prepare to invoke the func object. If the nr_args is too large, disrupt. Allocate the new activation frame. Put the current frame pointer into it.
|
|
||||||
|
|
||||||
"goframe", dest, func, nr_args
|
|
||||||
|
|
||||||
Same as frame, except that the current frame is reused if it is large enough.
|
|
||||||
|
|
||||||
"invoke", frame
|
|
||||||
|
|
||||||
Store the next instruction address in the current frame. Make the new frame the current frame. Jump to the entry point.
|
|
||||||
|
|
||||||
"goinvoke", frame
|
|
||||||
|
|
||||||
"apply", func, array
|
|
||||||
|
|
||||||
"return", value
|
|
||||||
|
|
||||||
"return_value", dest
|
|
||||||
|
|
||||||
"setarg", frame, slot, value // set the slot of frame to value
|
|
||||||
|
|
||||||
### Branching
|
|
||||||
|
|
||||||
"jump", label
|
|
||||||
|
|
||||||
"jump_true", slot, label
|
|
||||||
|
|
||||||
If the value in the slot is true, jump to the label. Otherwise, continue with the next instruction.
|
|
||||||
|
|
||||||
"jump_false": slot, label
|
|
||||||
|
|
||||||
If the value in the slot is false, jump to the label. Otherwise, continue with the next instruction.
|
|
||||||
|
|
||||||
"jump_null": slot, label
|
|
||||||
|
|
||||||
"jump_empty": slot, label
|
|
||||||
|
|
||||||
"wary_true", slot, label
|
|
||||||
|
|
||||||
If the value in the slot is true, jump to the label. If the value is false, continue with the next instruction. Otherwise disrupt because of a type error.
|
|
||||||
|
|
||||||
"wary_false": slot, label
|
|
||||||
|
|
||||||
If the value in the slot is false, jump to the label. If the value is true, continue with the next instruction. Otherwise disrupt because of a type error.
|
|
||||||
|
|
||||||
### Sensory
|
|
||||||
|
|
||||||
Does the right slot contain a value of the indicated type?
|
|
||||||
|
|
||||||
"array?", dest, right
|
|
||||||
|
|
||||||
"blob?", dest, right
|
|
||||||
|
|
||||||
"character?", dest, right
|
|
||||||
|
|
||||||
"data?", dest, right
|
|
||||||
|
|
||||||
"digit?", dest, right
|
|
||||||
|
|
||||||
"false?", dest, right
|
|
||||||
|
|
||||||
"fit?", dest, right
|
|
||||||
|
|
||||||
"function?", dest, right
|
|
||||||
|
|
||||||
"integer?", dest, right
|
|
||||||
|
|
||||||
"letter?", dest, right
|
|
||||||
|
|
||||||
"logical?", dest, right
|
|
||||||
|
|
||||||
"null?", dest, right
|
|
||||||
|
|
||||||
"pattern?", dest, right
|
|
||||||
|
|
||||||
"record?", dest, right
|
|
||||||
|
|
||||||
"stone?", dest, right
|
|
||||||
|
|
||||||
"text?", dest, right
|
|
||||||
|
|
||||||
"true?", dest, right
|
|
||||||
|
|
||||||
"upper?", dest, right
|
|
||||||
|
|
||||||
"whitespace?", dest, right
|
|
||||||
|
|
||||||
### Potpourri
|
|
||||||
|
|
||||||
"stone", dest, right // stone an object
|
|
||||||
|
|
||||||
"true", dest
|
|
||||||
|
|
||||||
"false", dest
|
|
||||||
|
|
||||||
"null", dest
|
|
||||||
|
|
||||||
"move", dest, right
|
|
||||||
|
|
||||||
"int", dest, small_int
|
|
||||||
|
|
||||||
"access", dest, literal
|
|
||||||
|
|
||||||
This is used to access values (numbers, texts) from the program's immutable memory. The literal is a number or text.
|
|
||||||
|
|
||||||
"load", dest, object, subscript
|
|
||||||
|
|
||||||
This is used to load values from records and arrays.
|
|
||||||
|
|
||||||
"store", dest, object, subscript
|
|
||||||
|
|
||||||
This is used to store values into records and arrays.
|
|
||||||
|
|
||||||
"delete", object, subscript
|
|
||||||
|
|
||||||
used to delete a field from a record.
|
|
||||||
|
|
||||||
"get", dest, slot, level
|
|
||||||
|
|
||||||
This is used to get values from slots in outer frames.
|
|
||||||
|
|
||||||
"put", value, slot, level
|
|
||||||
|
|
||||||
This is used to store values into slots in outer frames.
|
|
||||||
|
|
||||||
"push", array, slot
|
|
||||||
|
|
||||||
Append to a mutable array.
|
|
||||||
|
|
||||||
"pop", dest, array
|
|
||||||
|
|
||||||
Remove the last element of a mutable array, putting the element into dest.
|
|
||||||
|
|
||||||
"disrupt"
|
|
||||||
|
|
||||||
### Make
|
|
||||||
|
|
||||||
"array", dest, nr_elements
|
|
||||||
|
|
||||||
"blob", dest, nr_bits
|
|
||||||
|
|
||||||
"function", dest, code_name_text
|
|
||||||
|
|
||||||
"pretext", dest, nr_characters
|
|
||||||
|
|
||||||
A pretext must be converted to text by stone before it can leave the function scope.
|
|
||||||
|
|
||||||
"record", dest, nr_elements
|
|
||||||
|
|
||||||
30
website/content/_index.md
Normal file
30
website/content/_index.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
title: "ƿit"
|
||||||
|
---
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// hello.ce — a simple actor
|
||||||
|
log.console("Hello, ƿit!")
|
||||||
|
$stop()
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pit hello
|
||||||
|
```
|
||||||
|
|
||||||
|
## Why ƿit
|
||||||
|
|
||||||
|
- **Actors, not threads** — isolated memory, message passing, no shared state. Concurrent programs that are safe by default.
|
||||||
|
- **Everything is stoned** — `stone()` makes values permanently immutable. Messages between actors are frozen automatically. No defensive copying.
|
||||||
|
- **Prototypes, not classes** — objects inherit directly from other objects. No class hierarchies, no `new`, no `this` confusion.
|
||||||
|
- **C when you need it** — drop a `.c` file in your package and it becomes a native module. No FFI bindings, no build scripts.
|
||||||
|
- **Small and predictable** — DEC64 numbers with no rounding errors. No `undefined`. Strict equality only. A runtime that fits in your head.
|
||||||
|
|
||||||
|
<div class="home-art">
|
||||||
|
<img src="/images/wizard.png" alt="ƿit wizard">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="home-links">
|
||||||
|
<a href="/start/">Get Started</a>
|
||||||
|
<a href="/docs/">Documentation</a>
|
||||||
|
</div>
|
||||||
154
website/content/start/_index.md
Normal file
154
website/content/start/_index.md
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
---
|
||||||
|
title: "Getting Started"
|
||||||
|
description: "Install ƿit and write your first program"
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- A C compiler (gcc or clang)
|
||||||
|
- [Meson](https://mesonbuild.com/) build system
|
||||||
|
- Git
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
git clone https://gitea.pockle.world/john/cell
|
||||||
|
cd cell
|
||||||
|
|
||||||
|
# Bootstrap the build
|
||||||
|
make bootstrap
|
||||||
|
```
|
||||||
|
|
||||||
|
This compiles the ƿit runtime and installs the `pit` binary. The ƿit shop is created at `~/.pit/`.
|
||||||
|
|
||||||
|
Verify your installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pit version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Hello World
|
||||||
|
|
||||||
|
Create a file called `hello.ce`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// hello.ce
|
||||||
|
log.console("Hello, ƿit!")
|
||||||
|
$stop()
|
||||||
|
```
|
||||||
|
|
||||||
|
Run it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pit hello
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see `Hello, ƿit!` printed to the console.
|
||||||
|
|
||||||
|
Every `.ce` file is an **actor** — an independent unit of execution. The `$stop()` call tells the actor to shut down when it's done.
|
||||||
|
|
||||||
|
## A Counting Actor
|
||||||
|
|
||||||
|
Actors can schedule work over time. Create `counter.ce`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// counter.ce
|
||||||
|
var count = 0
|
||||||
|
|
||||||
|
$clock(function(dt) {
|
||||||
|
count = count + 1
|
||||||
|
log.console(`tick ${count}`)
|
||||||
|
if (count >= 5) {
|
||||||
|
$stop()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pit counter
|
||||||
|
```
|
||||||
|
|
||||||
|
The `$clock` intrinsic calls your function every tick. The actor runs until you stop it.
|
||||||
|
|
||||||
|
## Two Actors Talking
|
||||||
|
|
||||||
|
The power of ƿit is in actors communicating through messages. Create two files:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// greeter.ce
|
||||||
|
$receiver(function(msg, reply) {
|
||||||
|
reply({greeting: `Hello, ${msg.name}!`})
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// main.ce
|
||||||
|
$start(function(greeter) {
|
||||||
|
$send(greeter, {name: "world"}, function(response) {
|
||||||
|
log.console(response.greeting)
|
||||||
|
$stop()
|
||||||
|
})
|
||||||
|
}, "greeter")
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pit main
|
||||||
|
```
|
||||||
|
|
||||||
|
`$start` launches a new actor. `$send` sends a message and provides a callback for the reply. Messages are automatically serialized — actors never share memory.
|
||||||
|
|
||||||
|
## Using Modules
|
||||||
|
|
||||||
|
Modules (`.cm` files) return a value that is cached and frozen. Create a module:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// math_helpers.cm
|
||||||
|
function square(x) {
|
||||||
|
return x * x
|
||||||
|
}
|
||||||
|
|
||||||
|
function distance(x1, y1, x2, y2) {
|
||||||
|
var math = use('math/radians')
|
||||||
|
var dx = x2 - x1
|
||||||
|
var dy = y2 - y1
|
||||||
|
return math.sqrt(dx * dx + dy * dy)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
square: square,
|
||||||
|
distance: distance
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Use it from an actor:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// calc.ce
|
||||||
|
var helpers = use('math_helpers')
|
||||||
|
|
||||||
|
log.console(helpers.square(5)) // 25
|
||||||
|
log.console(helpers.distance(0, 0, 3, 4)) // 5
|
||||||
|
|
||||||
|
$stop()
|
||||||
|
```
|
||||||
|
|
||||||
|
## Creating a Package
|
||||||
|
|
||||||
|
To share code or manage dependencies, create a `pit.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
package = "myproject"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
```
|
||||||
|
|
||||||
|
Your package can now use `pit build`, `pit test`, and install dependencies.
|
||||||
|
|
||||||
|
## What's Next
|
||||||
|
|
||||||
|
- [**ƿit Language**](/docs/language/) — full syntax reference
|
||||||
|
- [**Actors and Modules**](/docs/actors/) — the execution model in depth
|
||||||
|
- [**Packages**](/docs/packages/) — code organization and sharing
|
||||||
|
- [**Standard Library**](/docs/library/) — built-in modules
|
||||||
41
website/data/docs_nav.yaml
Normal file
41
website/data/docs_nav.yaml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
sections:
|
||||||
|
- title: "Language"
|
||||||
|
pages:
|
||||||
|
- title: "Language Reference"
|
||||||
|
url: "/docs/language/"
|
||||||
|
- title: "Actors and Modules"
|
||||||
|
url: "/docs/actors/"
|
||||||
|
- title: "Packages"
|
||||||
|
url: "/docs/packages/"
|
||||||
|
- title: "Tools"
|
||||||
|
pages:
|
||||||
|
- title: "CLI"
|
||||||
|
url: "/docs/cli/"
|
||||||
|
- title: "C Modules"
|
||||||
|
url: "/docs/c-modules/"
|
||||||
|
- title: "Reference"
|
||||||
|
pages:
|
||||||
|
- title: "Built-in Functions"
|
||||||
|
url: "/docs/functions/"
|
||||||
|
- title: "Standard Library"
|
||||||
|
pages:
|
||||||
|
- title: "Overview"
|
||||||
|
url: "/docs/library/"
|
||||||
|
- title: "text"
|
||||||
|
url: "/docs/library/text/"
|
||||||
|
- title: "number"
|
||||||
|
url: "/docs/library/number/"
|
||||||
|
- title: "array"
|
||||||
|
url: "/docs/library/array/"
|
||||||
|
- title: "object"
|
||||||
|
url: "/docs/library/object/"
|
||||||
|
- title: "blob"
|
||||||
|
url: "/docs/library/blob/"
|
||||||
|
- title: "time"
|
||||||
|
url: "/docs/library/time/"
|
||||||
|
- title: "math"
|
||||||
|
url: "/docs/library/math/"
|
||||||
|
- title: "json"
|
||||||
|
url: "/docs/library/json/"
|
||||||
|
- title: "random"
|
||||||
|
url: "/docs/library/random/"
|
||||||
33
website/hugo.toml
Normal file
33
website/hugo.toml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
baseURL = 'https://pit-lang.org/'
|
||||||
|
languageCode = 'en-us'
|
||||||
|
title = 'ƿit'
|
||||||
|
theme = 'knr'
|
||||||
|
|
||||||
|
[markup]
|
||||||
|
[markup.highlight]
|
||||||
|
noClasses = false
|
||||||
|
style = 'monokailight'
|
||||||
|
[markup.goldmark]
|
||||||
|
[markup.goldmark.renderer]
|
||||||
|
unsafe = true
|
||||||
|
|
||||||
|
[menus]
|
||||||
|
[[menus.main]]
|
||||||
|
name = 'Getting Started'
|
||||||
|
pageRef = '/start/'
|
||||||
|
weight = 10
|
||||||
|
[[menus.main]]
|
||||||
|
name = 'Documentation'
|
||||||
|
pageRef = '/docs/'
|
||||||
|
weight = 20
|
||||||
|
|
||||||
|
[module]
|
||||||
|
[[module.mounts]]
|
||||||
|
source = "content"
|
||||||
|
target = "content"
|
||||||
|
[[module.mounts]]
|
||||||
|
source = "../docs"
|
||||||
|
target = "content/docs"
|
||||||
|
|
||||||
|
[params]
|
||||||
|
description = 'An actor-based scripting language for building concurrent applications.'
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
site_name: Cell
|
|
||||||
docs_dir: ../docs
|
|
||||||
|
|
||||||
theme:
|
|
||||||
name: mkdocs
|
|
||||||
color_mode: auto
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
mkdocs==1.6.1
|
|
||||||
13
website/static/_headers
Normal file
13
website/static/_headers
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
X-Frame-Options: DENY
|
||||||
|
X-Content-Type-Options: nosniff
|
||||||
|
Referrer-Policy: strict-origin-when-cross-origin
|
||||||
|
|
||||||
|
/fonts/*
|
||||||
|
Cache-Control: public, max-age=31536000, immutable
|
||||||
|
|
||||||
|
/images/*
|
||||||
|
Cache-Control: public, max-age=86400
|
||||||
|
|
||||||
|
/css/*
|
||||||
|
Cache-Control: public, max-age=86400
|
||||||
BIN
website/static/images/crab.png
Normal file
BIN
website/static/images/crab.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
BIN
website/static/images/favicon.gif
Normal file
BIN
website/static/images/favicon.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
website/static/images/orb.gif
Normal file
BIN
website/static/images/orb.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
BIN
website/static/images/wizard.png
Normal file
BIN
website/static/images/wizard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 379 KiB |
13
website/themes/knr/layouts/_default/baseof.html
Normal file
13
website/themes/knr/layouts/_default/baseof.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{{ .Site.LanguageCode }}">
|
||||||
|
<head>
|
||||||
|
{{ partial "head.html" . }}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{ partial "header.html" . }}
|
||||||
|
<main>
|
||||||
|
{{ block "main" . }}{{ end }}
|
||||||
|
</main>
|
||||||
|
{{ partial "footer.html" . }}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
6
website/themes/knr/layouts/_default/list.html
Normal file
6
website/themes/knr/layouts/_default/list.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
<article class="content-single">
|
||||||
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ .Content }}
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
||||||
6
website/themes/knr/layouts/_default/single.html
Normal file
6
website/themes/knr/layouts/_default/single.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
<article class="content-single">
|
||||||
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ .Content }}
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
||||||
9
website/themes/knr/layouts/docs/list.html
Normal file
9
website/themes/knr/layouts/docs/list.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
<div class="docs-layout">
|
||||||
|
{{ partial "nav-docs.html" . }}
|
||||||
|
<article class="docs-content">
|
||||||
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ .Content }}
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
9
website/themes/knr/layouts/docs/single.html
Normal file
9
website/themes/knr/layouts/docs/single.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
<div class="docs-layout">
|
||||||
|
{{ partial "nav-docs.html" . }}
|
||||||
|
<article class="docs-content">
|
||||||
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ .Content }}
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
13
website/themes/knr/layouts/index.html
Normal file
13
website/themes/knr/layouts/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
<div class="home">
|
||||||
|
<div class="hero">
|
||||||
|
<div class="wynn">ƿ</div>
|
||||||
|
<h1 class="hero-title">ƿit</h1>
|
||||||
|
<p class="hero-tagline">An actor-based language for building concurrent applications.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="home-content">
|
||||||
|
{{ .Content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
3
website/themes/knr/layouts/partials/footer.html
Normal file
3
website/themes/knr/layouts/partials/footer.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<footer class="site-footer">
|
||||||
|
<p>ƿit — an actor-based scripting language</p>
|
||||||
|
</footer>
|
||||||
9
website/themes/knr/layouts/partials/head.html
Normal file
9
website/themes/knr/layouts/partials/head.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} — {{ .Site.Title }}{{ end }}</title>
|
||||||
|
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
|
||||||
|
<link rel="icon" href="/images/favicon.gif" type="image/gif">
|
||||||
|
<link rel="preload" href="/fonts/charter-regular.woff" as="font" type="font/woff" crossorigin>
|
||||||
|
<link rel="preload" href="/fonts/jetbrains-mono-regular.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
|
<link rel="stylesheet" href="/css/syntax.css">
|
||||||
10
website/themes/knr/layouts/partials/header.html
Normal file
10
website/themes/knr/layouts/partials/header.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<header class="site-header">
|
||||||
|
<nav class="site-nav">
|
||||||
|
<a href="/" class="site-logo">ƿit</a>
|
||||||
|
<div class="nav-links">
|
||||||
|
{{ range .Site.Menus.main }}
|
||||||
|
<a href="{{ .URL }}"{{ if $.IsMenuCurrent "main" . }} class="active"{{ end }}>{{ .Name }}</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
16
website/themes/knr/layouts/partials/nav-docs.html
Normal file
16
website/themes/knr/layouts/partials/nav-docs.html
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<nav class="docs-nav">
|
||||||
|
<h3><a href="/docs/">Documentation</a></h3>
|
||||||
|
{{ $current := . }}
|
||||||
|
{{ range .Site.Data.docs_nav.sections }}
|
||||||
|
<div class="nav-section">
|
||||||
|
<h4>{{ .title }}</h4>
|
||||||
|
<ul>
|
||||||
|
{{ range .pages }}
|
||||||
|
<li{{ if eq $current.RelPermalink .url }} class="active"{{ end }}>
|
||||||
|
<a href="{{ .url }}">{{ .title }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</nav>
|
||||||
446
website/themes/knr/static/css/main.css
Normal file
446
website/themes/knr/static/css/main.css
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
/* K&R aesthetic — cream paper, serif fonts, sparse layout */
|
||||||
|
|
||||||
|
/* ---- Fonts ---- */
|
||||||
|
/* TODO: Add Junicode woff2 for the ƿ glyph (psb1558/Junicode-font on GitHub) */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Charter';
|
||||||
|
src: url('/fonts/charter-regular.woff') format('woff');
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Charter';
|
||||||
|
src: url('/fonts/charter-bold.woff') format('woff');
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: 'JetBrains Mono';
|
||||||
|
src: url('/fonts/jetbrains-mono-regular.woff2') format('woff2');
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Reset ---- */
|
||||||
|
*, *::before, *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Base ---- */
|
||||||
|
:root {
|
||||||
|
--bg: #FAF8F1;
|
||||||
|
--bg-code: #F2EFE4;
|
||||||
|
--text: #2C2C2C;
|
||||||
|
--text-secondary: #5C5C5C;
|
||||||
|
--accent: #4A3728;
|
||||||
|
--accent-hover: #2C2C2C;
|
||||||
|
--border: #D4CFC4;
|
||||||
|
--font-body: 'Charter', Georgia, 'Times New Roman', serif;
|
||||||
|
--font-code: 'JetBrains Mono', 'Source Code Pro', 'Menlo', monospace;
|
||||||
|
--font-wynn: 'Junicode', 'Charter', Georgia, serif;
|
||||||
|
--content-width: 720px;
|
||||||
|
--sidebar-width: 220px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: var(--font-body);
|
||||||
|
color: var(--text);
|
||||||
|
background: var(--bg);
|
||||||
|
line-height: 1.6;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Typography ---- */
|
||||||
|
h1, h2, h3, h4 {
|
||||||
|
font-family: var(--font-body);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
margin-top: 2.5rem;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
padding-bottom: 0.3rem;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
margin-top: 2rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--accent);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: var(--accent-hover);
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
em {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
margin: 2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul, ol {
|
||||||
|
padding-left: 1.5em;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
li > ul, li > ol {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
border-left: 3px solid var(--border);
|
||||||
|
padding-left: 1rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Code ---- */
|
||||||
|
code {
|
||||||
|
font-family: var(--font-code);
|
||||||
|
font-size: 0.85em;
|
||||||
|
background: var(--bg-code);
|
||||||
|
padding: 0.15em 0.35em;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: var(--bg-code);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 1rem 1.25rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
margin: 1rem 0 1.5rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre code {
|
||||||
|
background: none;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Tables ---- */
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 1rem 0 1.5rem;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
font-weight: 700;
|
||||||
|
border-bottom: 2px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Site Header ---- */
|
||||||
|
.site-header {
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-nav {
|
||||||
|
max-width: calc(var(--content-width) + var(--sidebar-width) + 2rem);
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-logo {
|
||||||
|
font-family: var(--font-wynn);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--text);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-logo:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links {
|
||||||
|
display: flex;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links a {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-links a:hover,
|
||||||
|
.nav-links a.active {
|
||||||
|
color: var(--text);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Site Footer ---- */
|
||||||
|
.site-footer {
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
padding: 1.5rem;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
margin-top: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Content ---- */
|
||||||
|
.content-single {
|
||||||
|
max-width: var(--content-width);
|
||||||
|
margin: 2rem auto;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Home Page ---- */
|
||||||
|
.home {
|
||||||
|
max-width: var(--content-width);
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
text-align: center;
|
||||||
|
padding: 3rem 0 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wynn {
|
||||||
|
font-family: var(--font-wynn);
|
||||||
|
font-size: 18rem;
|
||||||
|
line-height: 1;
|
||||||
|
color: var(--text);
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-family: var(--font-wynn);
|
||||||
|
font-size: 2.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-tagline {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
max-width: 480px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-content {
|
||||||
|
padding-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-content h2 {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-content .home-links {
|
||||||
|
display: flex;
|
||||||
|
gap: 1.5rem;
|
||||||
|
margin-top: 2rem;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-content .home-links a {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-art {
|
||||||
|
text-align: center;
|
||||||
|
margin: 2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home-art img {
|
||||||
|
max-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Docs Layout ---- */
|
||||||
|
.docs-layout {
|
||||||
|
max-width: calc(var(--content-width) + var(--sidebar-width) + 3rem);
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
gap: 2rem;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding-top: 2rem;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
max-height: 100vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav h3 {
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav h3 a {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav h4 {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav li {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav li a {
|
||||||
|
display: block;
|
||||||
|
padding: 0.2rem 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav li a:hover {
|
||||||
|
color: var(--text);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav li.active a {
|
||||||
|
color: var(--text);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 2rem 0 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-content h1 {
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Responsive ---- */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wynn {
|
||||||
|
font-size: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-layout {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.docs-nav {
|
||||||
|
width: 100%;
|
||||||
|
position: static;
|
||||||
|
max-height: none;
|
||||||
|
padding-top: 1rem;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-section {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 1.5rem;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-nav {
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.wynn {
|
||||||
|
font-size: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-section {
|
||||||
|
display: block;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
124
website/themes/knr/static/css/syntax.css
Normal file
124
website/themes/knr/static/css/syntax.css
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/* Muted, near-monochrome syntax highlighting — K&R aesthetic */
|
||||||
|
|
||||||
|
/* Background & default text */
|
||||||
|
.highlight pre {
|
||||||
|
background: #F2EFE4;
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keywords: bold, same color */
|
||||||
|
.highlight .k,
|
||||||
|
.highlight .kc,
|
||||||
|
.highlight .kd,
|
||||||
|
.highlight .kn,
|
||||||
|
.highlight .kp,
|
||||||
|
.highlight .kr,
|
||||||
|
.highlight .kt {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Strings: slightly lighter */
|
||||||
|
.highlight .s,
|
||||||
|
.highlight .s1,
|
||||||
|
.highlight .s2,
|
||||||
|
.highlight .sa,
|
||||||
|
.highlight .sb,
|
||||||
|
.highlight .sc,
|
||||||
|
.highlight .dl,
|
||||||
|
.highlight .se,
|
||||||
|
.highlight .sh,
|
||||||
|
.highlight .si,
|
||||||
|
.highlight .sx {
|
||||||
|
color: #5C5C5C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Comments: italic, lighter */
|
||||||
|
.highlight .c,
|
||||||
|
.highlight .c1,
|
||||||
|
.highlight .ch,
|
||||||
|
.highlight .cm,
|
||||||
|
.highlight .cp,
|
||||||
|
.highlight .cpf,
|
||||||
|
.highlight .cs {
|
||||||
|
color: #8B8B8B;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Numbers */
|
||||||
|
.highlight .m,
|
||||||
|
.highlight .mb,
|
||||||
|
.highlight .mf,
|
||||||
|
.highlight .mh,
|
||||||
|
.highlight .mi,
|
||||||
|
.highlight .mo {
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
.highlight .nf,
|
||||||
|
.highlight .fm {
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Operators */
|
||||||
|
.highlight .o,
|
||||||
|
.highlight .ow {
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Variables and names */
|
||||||
|
.highlight .n,
|
||||||
|
.highlight .na,
|
||||||
|
.highlight .nb,
|
||||||
|
.highlight .nc,
|
||||||
|
.highlight .nd,
|
||||||
|
.highlight .ne,
|
||||||
|
.highlight .ni,
|
||||||
|
.highlight .nl,
|
||||||
|
.highlight .nn,
|
||||||
|
.highlight .no,
|
||||||
|
.highlight .nt,
|
||||||
|
.highlight .nv,
|
||||||
|
.highlight .bp {
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Punctuation */
|
||||||
|
.highlight .p {
|
||||||
|
color: #2C2C2C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Template strings */
|
||||||
|
.highlight .sa {
|
||||||
|
color: #5C5C5C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Built-in constants */
|
||||||
|
.highlight .kc {
|
||||||
|
color: #2C2C2C;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Regular expressions */
|
||||||
|
.highlight .sr {
|
||||||
|
color: #5C5C5C;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Errors */
|
||||||
|
.highlight .err {
|
||||||
|
color: #2C2C2C;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Line numbers */
|
||||||
|
.highlight .ln {
|
||||||
|
color: #8B8B8B;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generic */
|
||||||
|
.highlight .gd { color: #5C5C5C; }
|
||||||
|
.highlight .gi { color: #2C2C2C; }
|
||||||
|
.highlight .ge { font-style: italic; }
|
||||||
|
.highlight .gs { font-weight: bold; }
|
||||||
BIN
website/themes/knr/static/fonts/charter-bold.woff
Normal file
BIN
website/themes/knr/static/fonts/charter-bold.woff
Normal file
Binary file not shown.
BIN
website/themes/knr/static/fonts/charter-regular.woff
Normal file
BIN
website/themes/knr/static/fonts/charter-regular.woff
Normal file
Binary file not shown.
BIN
website/themes/knr/static/fonts/jetbrains-mono-regular.woff2
Normal file
BIN
website/themes/knr/static/fonts/jetbrains-mono-regular.woff2
Normal file
Binary file not shown.
BIN
website/themes/knr/static/fonts/junicode-regular.woff2
Normal file
BIN
website/themes/knr/static/fonts/junicode-regular.woff2
Normal file
Binary file not shown.
Reference in New Issue
Block a user