Skip to content

grm-core 0.5.0: writing to the GRM machine, with help at hand, in English or French

Choose a tag to compare

@innermost47 innermost47 released this 12 Nov 10:38
· 4 commits to main since this release

The machine is programmed with relations, not steps, a new way of programming. This version puts help where the
typing is, gives programs a place of their own, and lets the interface speak French. The language itself does not
change: every 0.4.2 program runs as it is.

Requires pygrm ≥ 0.5.1 (unchanged).

New

  • Short forms and +/-. Every statement has a short form (nd, rel, obs, fgt, kp, net, cl, lrn,
    inp, out), and so does every long command (t tick, ld load, outs outputs, ins inspect, ms master, chk
    check, cap capacity, clk clock, h help, q quit, progs programs, rd read, o open, ed edit, sv
    save). +/- can be written for ±, which is not on every keyboard. Both work in files and at the prompt.
  • Help.
    • help lists every word by group, with its short form and a few words.
    • help WORD gives the word's form, what it is, an example, and for the main words a longer explanation.
    • tour is a guided tour in ten steps, each with a line to type: relations both ways, time, learning, programs,
      what the machine feels.
  • Under the prompt (window):
    • one line says what is being typed: the word, a few words on it, its form;
    • under it, a menu of words from the first letter, with their short forms. Names of nodes and relations appear
      from the second letter, and only when there are no more than twelve of them.
    • Up and Down choose, Tab or Enter takes, Esc closes.
    • The menu is optional: a box under it, or help on / help off.
  • Programs.
    • A program can begin with a header: #! name, #! does, #! try. Every example has one.
    • programs lists the programs with what they do, and with their inputs, outputs and networks, read from the
      program itself.
    • read NAME shows one here, its lines numbered.
    • new NAME starts one from a template that runs as it is.
    • run with no file runs the current tab.
  • The programs window (window):
    • open NAME opens a program in a window of its own, one tab per program, with line numbers and the same colours
      as the prompt.
    • Everything is done from the keyboard. Commands: tab N or tab NAME, edit, save, find, close.
    • Keys:
      • Ctrl+S saves;
      • F5 runs the tab line by line, and a line that fails turns red;
      • Ctrl+F searches (Enter for the next match, Shift+Enter for the one before);
      • Ctrl+Tab goes to the next tab, Ctrl+W closes one;
      • Esc goes back to the prompt.
    • An error in a file opened in a tab marks its line there.
  • English and French.
    • lang fr and lang en change the language of everything the machine says: answers, errors, help, the tour,
      the window, the cards under the mouse, the master equation.
    • At the first start it follows the language of the system.
    • The words of GRML stay English in both, so a program written in one runs in the other.
    • The choice, and that of the menu, are kept in vm/settings.json next to the memory (ignored by git). A machine
      without memory, as in the tests, neither reads nor writes them.
  • Docs.
    • docs/GRML.md gains a section on programs and the programs window, the short forms, the help and the two
      languages.
    • docs/GRML.fr.md is the whole of it in French. The outputs it quotes were run in French.
    • vm/README.md and README.md say the same in short.

Fixed

  • tab with no tab open now says so (it printed an empty line).
  • In the window, the legend measures its words instead of guessing their width, and goes onto a second row when it
    does not fit. The columns of mood and of the panel follow the longest word of the language. The note under the
    t − n slider is shorter, so it is no longer cut.

Inside

  • vm/i18n.py: tr(template, **values). Every text the machine says is an English template, and vm/fr.py gives it
    in French with the same fields. A template missing from the catalogue is said in English. label() writes a word
    with its colon as each language does ("error: ", "erreur : ").
  • vm/guide.py (help, tour), vm/programs.py (find, header, listing, template).
  • vm/editor.py: DOCS (form, a few words and an example for every word), the short forms, hint() and suggest()
    for the line and the menu under the prompt.

Tests

vm/test_vm.py 67 (10 new), vm/test_universe_unbiased.py 14, talk/ 10; the whole repository 203. The new tests
check:

  • the short forms and +/-;
  • the headers of every program, and programs, read and new;
  • help on every word, and that every word is in one group;
  • every line of the tour run on a machine born with its base;
  • that the French catalogue is whole: every text the machine may say, found in the code, with the same fields;
  • the language switched and remembered;
  • the line and the menu under the prompt;
  • the colon in each language.