• Simplication in ciforth

    From albert@albert@spenarnc.xs4all.nl to comp.lang.forth on Thu Oct 2 13:48:52 2025
    From Newsgroup: comp.lang.forth

    The words in the ONLY namespace 1] (minimum search order) is
    Subject: Simplification for ciforth
    X-Newsreader: trn 4.0-test77 (Sep 1, 2010)

    ' & ^ 0 1 2 3 4 5 6 7 8 9
    A B C D E F - + " FORTH

    Now I have used a trick in lisp compilers, defining an empty prefix.
    This is a catch-all and is used to automatically
    add a new symbol (as is customary in lisp.)
    In case you didn't notice, an empty prefix matches everything.

    So 7 now is defined as

    : 7 -1 PP +! (NUMBER) POSTPONE SDLITERAL
    ; IMMEDIATE PREFIX
    (The parse pointer is past the 7, so it must be backed up by
    one character.)

    I overlooked the possibility of an empty prefix in ONLY.

    : empty (NUMBER) POSTPONE SDLITERAL ; IMMEDIATE PREFIX

    Afterwards the name of 'empty definition must be replaced by an empty string. (In lisp that is , in the assembly listing this is no point.)

    This saves a lot of words in ONLY remaining:

    ' & ^ - + " FORTH

    For xt/nt/dea denotation : ' 'DROP
    For a char : & &A
    For a control char : ^ ^C
    For a number with an explicit sign : +10 -11
    For a string : " "ORANG UTAN"

    And FORTH to rule it all, get the system under control after ONLY.

    This save 10 lines in the generic file, a whopping 300 lines in the
    assembly listing and almost a kilobyte in the executable.
    It adds a paragraph in the documentation.
    All tricks by revectoring (NUMBER) for floating point still work.

    Remember the Chinese proverb cited by prof Ting.

    To attain knowledge add something every day
    To attain wisdom remove something every day

    Groetjes Albert

    1] NAMESPACE is a defining word, creating a wordlist, compare
    VOCABULARY. ALSO is builtin, which makes more sense.
    --
    The Chinese government is satisfied with its military superiority over USA.
    The next 5 year plan has as primary goal to advance life expectancy
    over 80 years, like Western Europe.
    --- Synchronet 3.21a-Linux NewsLink 1.2