IIRC the reason I only allowed single-byte identifiers was to simplify the symbol table, which is implemented by these four lines of code:
: Type Four* header 6144 + + ; ( Table of definition Types: 1=code, 2=data )
: Addr Type 1024 + ; ( table of definition Addresses )
( register a colon definition )
: Colon %flush dup Type 1 xchg ! HERE @ xchg Addr ! ;
( register a variable definition )
: Var %flush dup Type 2 xchg ! HERE @ xchg Addr ! ;
Abbreviating this as follows would clearly be highly immoral, so I would never do that:
: T F h 6144 + + ; : A T 1024 + ; : C % d T 1 x ! H @ x A ! ; : V % d T 2 x ! H @ A ! ;
"Parsing" is kind of the same as it would be if more bytes in the name were significant, because the other bytes in the name are still there in the source and the compiler still has to skip them:
What's simpler is that it doesn't have to store them anywhere, or implement any kind of string compare operation, and consequently doesn't use C@, and consequently doesn't have to implement C@ either. It implements @ and ! and C! (which it calls "store"; I should have called it "c!" since capital "C" was already taken for "colon"). It needs C! ("store") for emitting sub-word-length instructions and at any rate for backpatching jumps.
It's definitely a questionable choice, though! I think it might be worth using two significant letters instead of one for a "tiny boot FORTH".
Traditional FORTHs, you probably recall, used a fixed-size four-byte "name" in their dictionaries: a length byte and the first three letters of the name. Chuck Moore received some criticism for this choice, in response to which he wrote a letter to a popular FORTH magazine arguing, effectively, that thr-- let---- was ade----- to tel- wor-- apa--; col------- bet---- wor-- wer- suf--------- rar- wit- the fir-- thr-- let---- bei-- sig--------, and of cou--- it was mor- eff------. FTP and SMTP commands are all four letters long for the same reason.
IIRC the reason I only allowed single-byte identifiers was to simplify the symbol table, which is implemented by these four lines of code:
Abbreviating this as follows would clearly be highly immoral, so I would never do that: "Parsing" is kind of the same as it would be if more bytes in the name were significant, because the other bytes in the name are still there in the source and the compiler still has to skip them: What's simpler is that it doesn't have to store them anywhere, or implement any kind of string compare operation, and consequently doesn't use C@, and consequently doesn't have to implement C@ either. It implements @ and ! and C! (which it calls "store"; I should have called it "c!" since capital "C" was already taken for "colon"). It needs C! ("store") for emitting sub-word-length instructions and at any rate for backpatching jumps.It's definitely a questionable choice, though! I think it might be worth using two significant letters instead of one for a "tiny boot FORTH".
Traditional FORTHs, you probably recall, used a fixed-size four-byte "name" in their dictionaries: a length byte and the first three letters of the name. Chuck Moore received some criticism for this choice, in response to which he wrote a letter to a popular FORTH magazine arguing, effectively, that thr-- let---- was ade----- to tel- wor-- apa--; col------- bet---- wor-- wer- suf--------- rar- wit- the fir-- thr-- let---- bei-- sig--------, and of cou--- it was mor- eff------. FTP and SMTP commands are all four letters long for the same reason.