hugo website for pit

This commit is contained in:
2026-02-07 12:01:58 -06:00
parent 83ea67c01b
commit bae4e957e9
50 changed files with 1531 additions and 1533 deletions

30
website/content/_index.md Normal file
View 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>

View 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

View 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
View 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.'

View File

@@ -1,6 +0,0 @@
site_name: Cell
docs_dir: ../docs
theme:
name: mkdocs
color_mode: auto

View File

@@ -1 +0,0 @@
mkdocs==1.6.1

13
website/static/_headers Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

View 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>

View File

@@ -0,0 +1,6 @@
{{ define "main" }}
<article class="content-single">
<h1>{{ .Title }}</h1>
{{ .Content }}
</article>
{{ end }}

View File

@@ -0,0 +1,6 @@
{{ define "main" }}
<article class="content-single">
<h1>{{ .Title }}</h1>
{{ .Content }}
</article>
{{ end }}

View 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 }}

View 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 }}

View 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 }}

View File

@@ -0,0 +1,3 @@
<footer class="site-footer">
<p>ƿit &mdash; an actor-based scripting language</p>
</footer>

View 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">

View 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>

View 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>

View 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;
}
}

View 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; }

Binary file not shown.

Binary file not shown.

Binary file not shown.