Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ The dictionary and toolkit for the **grid script**: how humans write down what R
**Docs:** https://interimm.github.io/glyph-cli/

```sh
uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR.TIME ONE.137
uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR.TIME COUNT.137
```

```text
+++.+++ .+..+.+ .....+.
+++.+.. +++.+.+ .+....+
+++.+++ .+..+.+ ......+
+++.+.. +++.+.+ ......+
+++.+++ .+..+.+ +++...+
BODY.OTHER: your world
STAR.TIME: pulsar
ONE.137: 137
COUNT.137: 137
```

## Install
Expand All @@ -28,7 +28,7 @@ Python 3.10 or newer, no other dependencies.
## Use

```sh
glyph parts # the 15 parts
glyph parts # the 16 parts
glyph find wind # search meanings
glyph check BODY.STAR # is it a word? exit 1 if not
glyph show BODY.OTHER --symbol × # draw words
Expand Down
8 changes: 4 additions & 4 deletions docs/assets/examples/how-many.drawing.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.+..+.+..............+.
+++.+.+..+.......+..+.+
.+..+.+..............+.
.+..+.+..........+.....
+++.+.+..+......+.+....
.+..+.+..........+..+++
.......................
.......................
......................×
....................×..
................×××.×..
26 changes: 13 additions & 13 deletions docs/assets/examples/how-many.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/assets/examples/pulsars.drawing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
.......................
.......................
.+..+.+................
+++.+.+..+.......+....+
.+..+.+.............+..
+++.+.+..+............+
.+..+.+.........+++.+..
8 changes: 4 additions & 4 deletions docs/assets/examples/pulsars.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 17 additions & 12 deletions docs/assets/parts.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
SELF OTHER STAR LIGHT BODY
### ### .#. #.# ###
#.# #.. ### .#. ###
### ### .#. #.# ###
SELF OTHER STAR LIGHT
### ### .#. #.#
#.# #.. ### .#.
### ### .#. #.#

AIR WATER TIME VOICE PATH
#.# ### #.# #.. ...
... ... #.# ##. ###
#.# ### #.# ### ...
BODY AIR WATER TIME
### #.# ### #.#
### ... ... #.#
### #.# ### #.#

NOT ONE BEFORE AFTER OPEN
#.. ... ... ... .#.
.#. .#. #.. ..# #.#
..# ... ... ... .#.
VOICE PATH NOT ONE
#.. ... #.. ...
##. ### .#. .#.
### ... ..# ...

BEFORE AFTER OPEN COUNT
... ... .#. ...
#.. ..# #.# ...
... ... .#. ###
6 changes: 3 additions & 3 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ usage: glyph [-h] [--version] [--vocab PATH] COMMAND ...
glyph: the dictionary and toolkit for the grid script of Ross 128 b.

Words are written KIND.WHICH (BODY.OTHER = "your world"), or KIND alone.
A number is ONE.<n> (0-511). "_" is an empty position or an empty word.
A number is COUNT.<n> (0-511); COUNT alone is zero. "_" is an empty position or an empty word.
Pages are text files, one band per line: "SYMBOL: node | relation | node".

positional arguments:
COMMAND
parts list the 15 parts and the relation markers
parts list the parts and the relation markers
list list the vocabulary
check is a word in the vocabulary? (exit 1 if not)
find search meanings and notes
Expand Down Expand Up @@ -43,7 +43,7 @@ Run `glyph init` to make an editable copy. Docs: https://interimm.github.io/glyp
$ glyph parts --help
usage: glyph parts [-h] [--json]

list the 15 parts and the relation markers
list the parts and the relation markers

options:
-h, --help show this help message and exit
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ glyph --version

## Look at the parts

Everything is built from 15 parts, each a 3×3 shape.
Everything is built from 16 parts, each a 3×3 shape.

```sh
glyph parts
Expand All @@ -49,7 +49,7 @@ glyph check BODY.STAR # no, and its literal reading
glyph show BODY.OTHER BODY.SELF --symbol ×
```

Numbers are built in: `ONE.137` is 137, drawn as nine bits.
Numbers are built in: `COUNT.137` is 137, its which drawn as nine bits. `COUNT` alone is zero.

## Write a page

Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ It draws words and pages on the lattice, keeps the vocabulary honest, reads a pa
No install needed if you have [uv](https://docs.astral.sh/uv/):

```sh
uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR.TIME ONE.137
uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR.TIME COUNT.137
```

```text
+++.+++ .+..+.+ .....+.
+++.+.. +++.+.+ .+....+
+++.+++ .+..+.+ ......+
+++.+.. +++.+.+ ......+
+++.+++ .+..+.+ +++...+
BODY.OTHER: your world
STAR.TIME: pulsar
ONE.137: 137
COUNT.137: 137
```

Then follow [Getting started](getting-started.md).
Expand All @@ -31,7 +31,7 @@ Then follow [Getting started](getting-started.md).

| Command | What for |
|---|---|
| `glyph parts` | The 15 parts and what they mean as a thing and as a relation |
| `glyph parts` | The 16 parts and what they mean as a thing and as a relation |
| `glyph list`, `find`, `check` | Look words up |
| `glyph show` | Draw words |
| `glyph render` | Draw a whole page, as text or as SVG pixels |
Expand Down
2 changes: 1 addition & 1 deletion docs/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A page is a plain text file that `glyph render`, `glyph graph` and `glyph decode
- The first band of a block is the **statement**, one edge of the graph. Bands under it are **other voices** replying, part by part.
- A **blank line** starts the next statement.
- `#` starts a comment.
- A word is `KIND.WHICH`, `KIND`, `_.WHICH`, or `_` for nothing. Numbers are `ONE.0` to `ONE.511` (or `_.12` in a reply).
- A word is `KIND.WHICH`, `KIND`, `_.WHICH`, or `_` for nothing. Numbers are `COUNT.0` to `COUNT.511`; `COUNT` alone is zero (in a reply under a number, `_.12` changes just the bits).
- A symbol is any single character except a space, `.`, `#`, `|`, `:` and `_`. By convention `+` is Ross 128 b and `×` is Earth.

```text
Expand Down
9 changes: 5 additions & 4 deletions docs/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ This is the grammar `glyph` implements: version 7 of the grid script, where **a
| BEFORE | earlier | — |
| AFTER | later | — |
| OPEN | what goes here? | — |
| COUNT | number | — |

## Relations

Expand All @@ -58,21 +59,21 @@ A relation is one part (the action) plus a which that marks time or polarity:

## Numbers

`ONE` with a which read as nine bits, 256 down to 1, left to right and top to bottom. `ONE.137`:
`COUNT` plus a which read as nine bits, 256 down to 1, left to right and top to bottom. `COUNT` alone is zero. `COUNT.137`:

```text
.....+.
.+....+
......+
+++...+
```

!!! note "Numbers that look like words"
Some numbers spell a part's shape: 495 is drawn exactly like `SELF`, so `ONE.495` and `ONE.SELF` (*one of us*) look the same on the page. When a drawing is read back, `glyph decode` reads such a which as the vocabulary word, and `glyph check ONE.495` warns about it. The clashes today are 16 (`ONE.ONE`), 170 (`ONE.OPEN`), 273 (`ONE.NOT`), 487 (`ONE.OTHER`) and 495 (`ONE.SELF`). `ONE.0` draws nothing in the which, so it reads back as `ONE` alone.
COUNT is the only kind whose which is read as bits, and it never takes a part as its which, so a number can never be drawn like a word. (Under the old rule, numbers were `ONE` plus bits, and 495 was drawn exactly like `ONE.SELF`, *one of us*.)

## "That" and questions

- `ONE` alone in a node slot means **that**: the statement on the line above.
- `OPEN` in any position asks **what goes here?** The asker leaves an empty band for the answer, and whatever is drawn under `OPEN` replaces it. `OPEN` as a relation's which asks yes or no.
- **How many?** is `OPEN.COUNT` (*what number?*), answered with a `COUNT` word.

## How the machine reads a page

Expand Down
4 changes: 2 additions & 2 deletions docs/vocabulary.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Vocabulary

How words are made: a **kind** part narrowed by a **which** part (`KIND.WHICH`). A single part is a word
on its own. Any part can also be a **relation**, and numbers (`ONE.0` to `ONE.511`) are built in, so they
on its own. Any part can also be a **relation**, and numbers (`COUNT.0` to `COUNT.511`) are built in, so they
are not listed. Status: **preliminary**, 55 words.

<!-- generated by `glyph export-md`; edit the vocabulary with the tool, not this file -->
Expand Down Expand Up @@ -93,5 +93,5 @@ are not listed. Status: **preliminary**, 55 words.
| `.......`<br>`.+.....`<br>`.......` | ONE | that | alone in a node slot: the line above |
| `.......`<br>`.+...+.`<br>`.......` | ONE.ONE | the same | |
| `....+..`<br>`.+...+.`<br>`......+` | ONE.NOT | different | |
| `.....+.`<br>`.+..+.+`<br>`.....+.` | ONE.OPEN | how many? | |
| `.+.....`<br>`+.+....`<br>`.+..+++` | OPEN.COUNT | how many? | "what number?"; answer with COUNT.n |
| `.+.....`<br>`+.+....`<br>`.+.....` | OPEN | what? | |
5 changes: 3 additions & 2 deletions examples/how-many.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# "How many pulsars?" Twelve.
+: STAR.TIME | ONE | ONE.OPEN
×: _ | _ | _.12
# OPEN.COUNT asks "what number?"; the answer COUNT.12 replaces OPEN with COUNT, and COUNT with the bits.
+: STAR.TIME | ONE | OPEN.COUNT
×: _ | _ | COUNT.12
2 changes: 1 addition & 1 deletion examples/pulsars.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# The same word on two lines is one node with two edges.
+: SELF | LIGHT.ONE | STAR.TIME

+: STAR.TIME | ONE | ONE.12
+: STAR.TIME | ONE | COUNT.12
6 changes: 3 additions & 3 deletions scripts/gen_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def cli_markdown() -> str:


def parts_text(vocab: Vocabulary) -> str:
"""The 15 parts drawn in rows of five, with their names above."""
"""The parts drawn in rows of four, with their names above."""
names = list(vocab.parts)
blocks = []
for i in range(0, len(names), 5):
row = names[i : i + 5]
for i in range(0, len(names), 4):
row = names[i : i + 4]
lines = ["".join(f"{n:<10}" for n in row).rstrip()]
for r in range(3):
lines.append("".join(f"{vocab.parts[n].shape[r]:<10}" for n in row).rstrip())
Expand Down
2 changes: 1 addition & 1 deletion src/glyph_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

from .script import Entry, GlyphError, Part, Vocabulary, Word

__version__ = "0.1.0"
__version__ = "0.2.0"

__all__ = ["Entry", "GlyphError", "Part", "Vocabulary", "Word", "__version__"]
19 changes: 5 additions & 14 deletions src/glyph_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
from .export import vocabulary_markdown
from .graph import format_graph, read_graph, to_dot
from .page import check_symbol, format_page, parse_page
from .script import GlyphError, Vocabulary, Word
from .script import NUMBER, GlyphError, Vocabulary

ENV_VOCAB = "GLYPH_VOCAB"

DESCRIPTION = """\
glyph: the dictionary and toolkit for the grid script of Ross 128 b.

Words are written KIND.WHICH (BODY.OTHER = "your world"), or KIND alone.
A number is ONE.<n> (0-511). "_" is an empty position or an empty word.
A number is COUNT.<n> (0-511); COUNT alone is zero. "_" is an empty position or an empty word.
Pages are text files, one band per line: "SYMBOL: node | relation | node".
"""

Expand Down Expand Up @@ -56,13 +56,6 @@ def emit_json(data: object) -> None:
print(json.dumps(data, indent=2, ensure_ascii=False))


def warn_twin(v: Vocabulary, word: Word) -> None:
if word.is_number:
twin = v.number_twin(word.which) # type: ignore[arg-type]
if twin:
print(f' note: drawn exactly like {twin.word} ("{twin.gloss}"); a reader sees that word', file=sys.stderr)


# ---------- commands ----------


Expand Down Expand Up @@ -105,9 +98,8 @@ def cmd_check(v: Vocabulary, a: argparse.Namespace) -> int:
if e:
print(f'yes: {word} = "{e.gloss}" ({e.domain})')
return 0
if word.kind == "ONE" and word.is_number:
print(f"yes: {word} = the number {word.which} (numbers are built in)")
warn_twin(v, word)
if word.kind == NUMBER:
print(f"yes: {word} = the number {word.which or 0} (numbers are built in)")
return 0
print(f"no: {word} is not in the vocabulary. Literal reading: {v.gloss(word)}")
same_kind = [x for x in v.entries if x.word.kind == word.kind]
Expand All @@ -133,7 +125,6 @@ def cmd_show(v: Vocabulary, a: argparse.Namespace) -> int:
print("\n".join(draw_words(v, words, check_symbol(a.symbol))))
for w in words:
print(f" {w}: {v.gloss(w)}")
warn_twin(v, w)
return 0


Expand Down Expand Up @@ -215,7 +206,7 @@ def add(name: str, func: Callable, help: str) -> argparse.ArgumentParser:
p.set_defaults(func=func)
return p

p = add("parts", cmd_parts, "list the 15 parts and the relation markers")
p = add("parts", cmd_parts, "list the parts and the relation markers")
p.add_argument("--json", action="store_true", help="print JSON")
p = add("list", cmd_list, "list the vocabulary")
p.add_argument("--domain", help="only domains containing this text")
Expand Down
Loading
Loading