[PicForth] Feature Requests

David McNab david at rebirthing.co.nz
Thu Nov 18 02:14:51 CET 2004


Hi,

Nice to see the PicForth community really coming alive.

I'd like to put forward some feature requests - things I'd like to 
implement myself, if I only understood the guts of the compiler better.

1) case ... of .. endof .. endcase

As per standard Forth

Since PicForth already has begin/while/repeat/until/if/then, the 
mechanisms for branch resolution are already in place.
While 'case' statements don't necessarily add more power to the 
language, they certainly make for far more readable code, and might even 
facilitate smaller code (eliminating dup/drop statements) etc.

I'm sure I'd not be the only one to greatly appreciate this.

If a 'case' implementation is out of the question, how about an 'elif', 
to save the ugliness of endlessly-nested 
if/else/if/else/if/else/then/then/then constructs?

2) Double-byte variables and operators
  - variable words '2variable', '2@', '2!', '2+!', '2-!'.
  - operator words '2+', '2-', '20='
  - little-endian stack/memory representation ( valL valH )
  - stack word '2swap'
  - other math operators like 2*, 2/, 2mod, 2/mod etc could
    be done as subroutines (even I could do this)

I'm often encountering the need for 2-byte operations, and to have this 
supported in PicForth would be a dream. As it is, I'm having to do a
lot of menial byte-shuffling to get things done

3) Statement block sanity checking

PicForth doesn't do much checking about whether :/;, if/else/then, 
'begin/again', 'begin/while/repeat' etc constructs are structured 
correctly. I just spent a while hunting a bug, which was caused by me
missing out a 'then'.

Also, PicForth is not complaining if it sees a ':' inside a word (or is 
this an intentional feature allowing one to call into the middle of a 
word?).

-- 
Cheers
David


More information about the PicForth mailing list