Open
Conversation
…to bss rather than text section which avoids the need to call mprotect(), rename things
… be wrapped with PROGRAM / END, also removes automatic bye token that was generated by END
…time.seedsource, so that we can run textual forth code without the tests or the banner
… writes to stderr, fix self-hosted tokenizer termination issue (was debugged with eemit)
…ng the nonstandard words on top of gForth's standard words, produces redefinition warnings
…seedForth-i386.pre containing some compiler words so we can do special handling for DTC
…sticated tracing and symbolic debug (via annotated trace) system used to debug the 65C02 port, the trace is also available for the Z80 port and can be used for comparison
…e caller's responsibility to do so if they need to, in the case of "new" this is done by replacing "new drop" with "new h," in the seedForth kernel, whereas in the case of "create" it is done by having the tokenizer prefix the body of the user's Definer-definition with "here h," -- or could make the latter a user responsibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background: The heads table is like a cut-down version of the Forth dictionary, that only records the entry point of each word, rather than the entry point, name and backlink. Heads are needed for mapping token numbers in
*.seedfiles to addresses.As mentioned in the previous PR, I wanted to make it so that heads are not created during seedForthInteractive -- because now that execution tokens are simply addresses, heads are not needed once we have loaded and started the
*.seedfile.To do this, I have modified the
newandcreatewords so that creation of heads is now a caller responsibility. The revisednewandcreatewords simply return thehereaddress as it was before creating the code field of the newly created token.For reference see, for example,
/i386/seedForth-i386.prewhere it defines thenewandcreatewords. The updated way:And then see
/common/seedForth.prewhere it refers to thenewword. The updated way:It's pleasing that we can now do something sensible with the address returned by
new, rather than the oldnew drop.Inserting a call to
h,aftercreateis harder. Consider the seedForth code in/common/seedForthRuntime.seedsource:Compare with the corresponding textual Forth code in
/common/runtime.forthwhich is used withseedForthInteractive:My analysis is that
Defineris a seedForthism, which does not exist in standard Forth, and which behaves like:, but gives the tokenizer a hook so that it can capture the name of the new word being defined, hereVariable, create a token for it, and thus keep the token numbering in sync. And we can see that the usage is identical, i.e. the two definitions are the same, except that:is replaced withDefinerin the seedForth source. To preserve this equivalence, what I've done is to have the tokenizer insert the sequencehere h,in the start of the Definer-body, somewhat as if the user had executed the following definition:Of course we could make this a user responsibility, in which case the user would have to write this (somewhat more pleasing):
But, I considered it too difficult for the user if they have to deviate too much from standard Forth. What do you think about it?
Update: I have just noticed that the
create ( x ) dropsequence is also a seedForthism, as compared with standard Forth whereCreatedoesn't seem to return an execution token (see the/common/runtime.forthsnippet I showed above). Because of this we might have some more latitude to change things, such as requiring the user to callcreate (x) h,. But I'm not sure.