fig-FORTH EXECUTE
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: fig-FORTH EXECUTE
Good point! I guess I did it that way just because the '02 Forth I had come from did it that way. And why did they? Maybe they separated it out for debugging, or maybe just because someone told them definitions shouldn't be so long, or maybe they had something else in mind that I haven't come across. I looked at several other Forths I have books on, and nobody else separated them out like that. I guess I could integrate mine and save a little memory. Thanks.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: fig-FORTH EXECUTE
IamRob wrote:
OOC, where else would either INTERPRETER or COMPILER be used outside of INTERPRET that would require them to have their own definitions?
Personally I like the all-in-one combination of all three in Fig Forth.
Personally I like the all-in-one combination of all three in Fig Forth.
But, yes, factoring eases testing and debugging as you are building a wordset, which is why many advise that most definitions should be two to seven words long. The shorter the word, the easier it is to identify and test all edge cases before moving on to the word that contains it.
In that example, a peephole optimizer could be added to the COMPILER word, without having to test whether a regression was introduced for the interpreter state.
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: fig-FORTH EXECUTE
BruceRMcF wrote:
For INTERPRETER one use case might be if the user wanted to set up a vocabulary of words to be used in an application (eg, a menu system) that are all interpreted.
Quote:
But, yes, factoring eases testing and debugging as you are building a wordset, which is why many advise that most definitions should be two to seven words long. The shorter the word, the easier it is to identify and test all edge cases before moving on to the word that contains it.
It could be integrated after being proven working though. Regarding these assertions that words should be so short, one problem I have is simply coming up with meaningful names that aren't just as long as the definition, or even longer. Another of course is the memory the extra headers take up, especially with the names being that long. Another is of course the performance hit because of the many additional occurrences of nest and unnest (which also may be hard on the return-stack space).
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: fig-FORTH EXECUTE
BruceRMcF wrote:
IamRob wrote:
OOC, where else would either INTERPRETER or COMPILER be used outside of INTERPRET that would require them to have their own definitions?
Personally I like the all-in-one combination of all three in Fig Forth.
Personally I like the all-in-one combination of all three in Fig Forth.
But, yes, factoring eases testing and debugging as you are building a wordset, which is why many advise that most definitions should be two to seven words long. The shorter the word, the easier it is to identify and test all edge cases before moving on to the word that contains it.
In that example, a peephole optimizer could be added to the COMPILER word, without having to test whether a regression was introduced for the interpreter state.
Or maybe something more like importing Pascals Procedure calls.
Re: fig-FORTH EXECUTE
IamRob wrote:
BruceRMcF wrote:
IamRob wrote:
OOC, where else would either INTERPRETER or COMPILER be used outside of INTERPRET that would require them to have their own definitions?
Personally I like the all-in-one combination of all three in Fig Forth.
Personally I like the all-in-one combination of all three in Fig Forth.
But, yes, factoring eases testing and debugging as you are building a wordset, which is why many advise that most definitions should be two to seven words long. The shorter the word, the easier it is to identify and test all edge cases before moving on to the word that contains it.
In that example, a peephole optimizer could be added to the COMPILER word, without having to test whether a regression was introduced for the interpreter state.