Start writing down command language ideas

Vectornaut 2025-11-06 10:13:09 +00:00
parent b922e39820
commit 5dd7b09abb

91
Command-language.md Normal file

@ -0,0 +1,91 @@
The dyna3 command language will provide a text-based way to interact with assemblies, parallel to the graphical interface. A mostly-commutative fragment of it will also be used to serialize assemblies. Here are some ideas about how it might be designed.
## Design goals
- Quick and comfortable to use during interactive sessions.
- Minimal punctuation.
## Syntax ideas
### General principles
- **Commands have verbs.** Each command should contain an implicit or explicit verb. It should be easy to learn to look at a command and see what the verb is.
- **Creation by presumption.** A command that presumes the existence of an element or regulator should create that element or regulator, as long as its specified unambiguously and it doesnt exist already.
### Elements
#### Creating elements
```
Sphere
```
Create a sphere with default parameters and a default ID. The verb in this command is implicit: “[let there be] a sphere.” We can think of this as [copula omission](https://en.wikipedia.org/wiki/Zero_copula). Creating a sphere through the graphical interface should have the same result.
### Observables and regulators
#### Referring to regulators
Given two elements `a` and `b`, we can refer to the angle between them as `Angle a b`. If the angle is being regulated, we can refer to the regulator in the same way.
We could make regulator references more visually coherent, and help distinguish them from identifiers, by requiring parentheses: `Angle(a b)`. This would be especially helpful for observables with short names, like an `X` observable for the $x$ coordinate of a point. In an expression like `X a`, the observable and the element are visually similar. The form `X(a)` makes it clear that `X` is a regulator.
#### Creating regulators
```
Angle a b
```
```
regulate Angle a b
```
Create a regulator for the angle between elements `a` and `b`. The implicit copula option is shorter, and more analogous to how you create an element, but it might introduce confusion about whether were referring to an observable or a regulator. The option with the explicit verb `regulate` makes it more clear that were referring to a regulator.
```
Angle a Sphere
```
By the **creation by presumption** principle, this should create a regulator for the angle between the element `a` and a new sphere.
### Identifiers
#### Assigning identifiers
```
a is Sphere
```
```
Sphere named a
```
Create a sphere, as described above, and set its identifier to `a`.
```
r is Angle a b
```
```
Angle a b named r
```
Assign the identifier `r` to the regulator for the angle between `a` and `b`, creating the regulator if it doesnt exist already.
```
a is c
```
```
c named a
```
Assign the a new identifier, `a`, to the object with the identifier `c`.
#### Nesting identifier assignments
```
r is Angle a b is Sphere
```
```
Angle a Sphere named b named r
```
It seems like this should assign the identifier `r` to the angle between `a` and a new sphere with identifier `b`. Readability is very poor for both versions!