Skip to content

SP Forth 5 road map

ruv edited this page Jul 15, 2024 · 11 revisions

Background

Why the next major version is required.

  1. SP-Forth/4 cannot be fully compatible with the Forth-2012 standard, due to conflict with some standard word names (it uses some names for other words, e.g. REQUIRE, see a comment).

  2. Avoid delivering incompatible (or unsupported) code.

Possible changes for new spf5 repository

  1. Default source files encoding should be UTF-8.
  2. Exclude incompatible or irrelevant files and directories. E.g. devel will be not compatible.
  3. Eliminate mixed case in filenames.

Should we keep all the versions history and rewrite it, or start the repository from the scratch?

By starting from scratch we can change the source code formatting conventions. E.g. to use lower case.

Rewrite history options

  • Exclude devel and some other directories
  • Change files encode into UTF-8.
  • Change all file names into the lower case.

Possible backward-incompatible changes or improvements

  • Standard notion of REQUIRE and REQUIRED (by Forth-2012)
  • By default, exit on error in command line (better for scripting); can be change by a command line option.
  • Fix POSTPONE for immediate words (as they can be STATE-dependent).
  • Remove [COMPILE] (see also a corresponding issue and testcase).
  • Remove NOTFOUND (in favour of Recognizer API).
  • Turn on the tail-call optimization (elimination) by default.

Possible options for backward-compatibility

  • Rename old REQUIRE and REQUIRED into REQUIRE-WORD and REQUIRED-WORD
  • Command line option (and also ini-file, and any source file) "spf4 mode" (todo: particular list of the tweaks)
  • An external module to support NOTFOUND.

Features and improvements (backward-compatible)

  • Quotations (the [: and ;] words) in the core.
  • The words [UNDEFINED] and [IF] in the core.
  • Fix issue of TEMP-WORDLIST by support dynamic dictionaries/partitions (as a separate unions of code, data and header spaces).
  • Some kind of case-insensitivity (as an option to turn on/off) in the core.
  • Obtain the default language (ru or en) for error messages from the environment.
  • Remove NON-OPT-WL, use a list of xt (currently ' (Tick) behaves incorrectly for a word from this wordlist that is redefined).
  • Optimizer: introduce an API to define a special compiler for a word.
  • Optimizer: do inlining for the r-stack operations.
  • Introduce Recognizer API.
  • Introduce an API to add actions to reset the system state on an error.
  • Locals: use Recognizer API (since : (Colon) should not change the order), properly reset an internal state on an error.

Possible architectural changes

  • For better performance
    • Separate code space from data space.
    • Avoid the return address manipulation.
  • Introduce clear API for Macroopt.
  • Change TC to support multiple target word lists.
  • Support any standard Forth system as a host for building.

Road map

... to be continue ...