[PicForth] revolutionary strategic idea

David McNab david at rebirthing.co.nz
Tue Dec 7 14:14:12 CET 2004


Hi,

Prior to hacking with PicForth, I was using the gputils toolchain, with 
its various compilers.

The thought has hit me that (in theory at least) it could be possible 
for PicForth to generate relocatable assembly. In fact, I had partly 
started on writing a forth compiler to do just that, before I noticed 
PicForth's quality and committed to using it.

Ideas towards this:
  - a 'big switch' which enables relocatable assembly mode
  - a word 'public' which causes the next defined word to be
    declared public in the generated assembly source
  - a word 'extern' or 'import' which allows imports of
    external symbols, eg:
      - extern variable fred
      - extern function mary
  - picforth compiler, when the 'big switch' is on, builds up
    a buffer of assembler source instead of binary

If PicForth could generate relocatable assembler, this would enable 
wonderful things like:
  - ability to access the prolific codebase of libraries written in
    other high level languages
  - ability to freeze completed picforth libs as binaries, and link
    to them
  - overall, the ability to blur language boundaries

Thoughts?

-- 
Cheers
David


More information about the PicForth mailing list