Skip to content
Bushmills edited this page Mar 10, 2022 · 31 revisions
  • as a matter of fact is yoda now much closer to a standard (2012) compliant Forth system than I originally envisioned. Remaining differences, especially missing words, are listed in the file missing

  • concepts:

    • forward referencing of words, either only those compiled to new words, or also those called upon while interpreting. Feature can be enabled and disabled any time (disabled by default)
    • not exactly a purely incremental compiler
      • semicolon triggers compilation. Up to then are words only buffered. This allows the compiler to do post processing the word, useful for
        • replacing code sequences against more efficient functional equivalents.
        • delegating some compilation tasks from words to post processing. For example, create ... does> defining words are ripped apart by the post processor. The run time "does>" part is stored separately, to give the define time words semantics applicator easier access to run time code. Mind you, this is bash targeted, which doesn't allow to simply point instruction pointer inside of a function.
  • specific words where deviating from ANS:

    • query doesn't exist. Instead there's query$ which utilises string stack to store input.
    • quit can't do a "real" warm start. It just - optionally - empties stacks, then nests to a new instance of quit. Not a huge problem as long as it loops in its infinite loop, but you may want to avoid tapping ctrl-c thousands of times.
  • Implementation

    • strings. An additional string stack has been added. Strings between double quotes are pushed to string stack. Standard compliant string words s" ." have been provided. These strings are less efficient in yoda than their string stack equivalents
    • there is no virtual machine. Compiling a word creates a bash function, containing, from a bash viewpoint, "native code". The yoda interpreter operates within the same shell environment as the functions its compiler generates - yoda doesn't shell (unless bash does for invoking an external command).
    • Due to its forward referencing capability does yoda not need all of the functionality necessary for compiling a program already prior to beginning of compilation. Instead can it resolve those after compilation on a need-to-include base. This allows for a more automatic and comfortable library inclusion management.
    • yoda has now eliminated immediate words and instead provided a "compileonly" wordlist. Word can be copied or moved there by executing immediate resp. compiled after a word has been created. Words in the compileonly wordlist will be executed when encountered during compilation, there mimicking immediate words.
Clone this wiki locally