Skip to content

Commit 0766d8f

Browse files
committed
agents: Clarify case independence and aliases
The agents kept getting RPL case independence wrng. A slightly stronger wording might help avoiding having useless aliases pop up in `ids.tbl` or useless test concerns about `x` vs `X`. Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
1 parent 2f995d6 commit 0766d8f

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ DB48X is a modern implementation of RPL (Reverse Polish Lisp) targeting SwissMic
2626
- `rg -t cpp "pattern"` to search only C++ files
2727
- `rg -l "pattern"` to list files (like `grep -l`)
2828
- `rg --files | rg "\.h$"` instead of `find . -name "*.h"`
29+
- **Do not add case-only aliases in `ids.tbl`.** Command parsing is
30+
case-independent, so `LIMIT`, `Limit`, and `limit` all refer to the same
31+
command once it is registered. Reserve `ALIAS` for spellings that differ in
32+
more than capitalization (e.g. `TAYLR` for `Taylor`, or `PartialFractions`
33+
for `PartFrac`). Symbol names are also case-independent by default
34+
(`IgnoreSymbolCase`): `X` and `x` are the same, as are `ABC`, `abc`, and
35+
`abC`. Do not treat capitalization as a distinct variable in docs, tests, or
36+
debugging. This does not apply to `` (`VX`): that object names the current
37+
algebra variable (`STOVX` / `RCLVX`), defaults to `x`, and after `'ABC'
38+
STOVX` denotes `ABC` — not `x`/`X`.
2939

3040
## Build System
3141

@@ -67,11 +77,10 @@ make -j8 dm32 # Build for DM32 (db50x.pg5)
6777
## Adding a New Command
6878

6979
1. **`src/ids.tbl`**: Add `NAMED(Foo, "→Foo")` or `CMD(Foo)`. Use `ALIAS` only
70-
for spellings that differ in more than case (parsing is case-independent).
80+
for spellings that differ in more than case (see general guideline above).
7181
Prefer `NAMED(ShortName, "LongSpelling")` when the C++ identifier is short
72-
(e.g. `NAMED(PRoot, "PolynomialRoots")`); do not add `ALIAS` entries that
73-
only change capitalization. Update any `ID_RANGE` lines whose boundary the
74-
new command changes (e.g. `is_command`, `is_algebraic_fn`).
82+
(e.g. `NAMED(PRoot, "PolynomialRoots")`). Update any `ID_RANGE` lines whose
83+
boundary the new command changes (e.g. `is_command`, `is_algebraic_fn`).
7584
2. **Header** (e.g. `src/functions.h`): Declare with `FUNCTION(Foo)`,
7685
`COMMAND_DECLARE(Foo, nargs)`, `COMMAND_DECLARE_FN(Foo, nargs)`, or
7786
`STANDARD_FUNCTION(Foo)` as appropriate (see below).

0 commit comments

Comments
 (0)