flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > Safety Forth features |
Author |
|
Hugh-Aguilar 12 Sep 2020, 19:36
Hugh-Aguilar wrote:
I'll provide the documentation for STRING-STACK.4TH in case anybody is interested. Nobody in the ANS-Forth cult liked my STRING-STACK.4TH. Elizabeth Rather of Forth Inc. provided PAD in ANS-Forth for the purpose of temporarily holding strings. Also, Wil Baden (Forth Inc. employee) implemented a string-stack back in the 1980s, which they believe covers the subject completely. To a large extent, being an ANS-Forth programmer just means supporting Forth Inc.. PAD is in the standard, and Wil Baden's string-stack is a de facto standard. They don't appreciate new code written outside of Forth Inc.. My STRING-STACK.4TH is a little different. I store the strings on the heap, and they can be any size. I have "unique" strings on the heap, and "derivative" strings that contain only a pointer into a unique or constant string. This means that when strings are juggled on the stack, it is not necessary to move entire strings around. Only the pointer and the char-count is in the stack element. I have COW (Copy-On-Write), so it is possible to work with derivative strings. The derivatives only get converted into uniques if they are being modified to or the unique that they are derived from is being modified. In practice, most of the strings on the string-stack are derivatives. This is because the primary purpose is pattern-matching, and the patterns are typically constants, so they are represented as derivatives on the string-stack. Working with strings is very fast because only pointers and counts are being used, and it is rare to need to allocate memory on the heap for a string and copy the string to that memory. Uniques get deallocated when they are consumed, but derivatives are faster because they don't have to be deallocated. The distinction between uniques and derivatives is internal --- the user just programs as if everything were a unique, and he doesn't need to know which strings are unique and which are derivative. My STRING-STACK.4TH can be the basis for a programming language, similar to how regular expressions are the basis for Perl. I need to find a home for this language though. Windows is a problem because anti-virus systems will red-flag it, and I don't want to pay for a certificate because I consider that to be extortion. Linux is a problem because software is required to be open-source. It seems obvious that Menuet needs a safe language for working with text. Safety Forth is a possibility. The Menuet developers may want to go with Perl or Java instead --- I wouldn't be involved in Menuet in either of these cases.
_________________ When all else fails, write the source. |
|||||||||||
12 Sep 2020, 19:36 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.