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.
Currently seedForth has a special syntax for defining words, for example
and this is necessary because we cannot really properly handle arguments to Forth words when working via the tokenizer, we can only sort of approximate it with workarounds for common use cases such as defining-words as seen here.
Referring to my last PR "Less use of heads", since I have changed the seedForth
createprimitive to no longer callh,to create a new head, we need to move this call into the seedForth defining-words, for exampleand I had done a workaround in my last PR where the tokenizer would automatically prepend
here h,to a definer, e.g.and this preserved seedsource compatibility. But I wasn't really all that happy with that workaround.
So in this PR I am trying a new approach which is more Forth-like, and allows us to define defining-words with a simple
:, e.g.and the trick here is that
Create(with a capital C) is now basically an immediate word which pulls some tricks in the tokenizer to mark the current colon-definition (the definition ofVariable) as a definer. Apart from that, it works kind of similarly to before.The code is well-commented so I will not go into the details of the algorithm here, except to say that:
Definerin as well, keeping seedsource compatibility;Macroandend-macroand might be reused.I have not rewritten all the library code to the new syntax yet, I can do that later if the PR is approved. I used the following test:
versus
Both should emit
BA.