Re: Structured Programming using Forth



I am probably going to regret replying to your post, but I want to
address one thing. You said several times, that programming the
SeaForth chip is more like assembly language than a high level
language. I think you are ignoring the fact that Forth is
extensible.

I don't agree with that. I don't know what tools they have but if you
are programming in Forth, then it should be a simple matter to
automate the examples you gave so that the programmer does not need to
know anything about them as he works. Changing a literal zero to a
DUP DUP XOR is just a matter of defining a word that is compiled
inline. If I understand the use of the NOPs to fill out a word to
force a particular alignment, that can also be automated as is done in
the tools for the VLIW TI DSPs. Using + and NOT to form - is also
just a matter of defining a word that is compiled inline.

I considered all of this when I was looking at a Forth compiler for a
stack CPU I had designed. Just like there is a flag to indicate that
a given word is immediate, a flag can indicate a word is to be
compiled inline. That is a significant improvment for small
definitions and helps keep the instruction set small.

I used operation usage frequency data from Koopman's book to structure
the instruction set and kept the set to about 37 unique instructions.
In developing the set I had to consider the efficiency of less often
used instruction if not made into opcodes. I realized that it would
be a simple matter to inline code the two or three opcodes required to
do this and the user would not need to know a thing about it.
Likewise I have a very few situations where NOPs would need to be used
to separate literals or to align instructions. Again this is simply
done by the compiler.

So there is nothing unique about the SeaForth chip that precludes the
use of Forth as a high level language.


John Passaniti wrote:

And on top of all this, it appears to me (and I welcome correction from
anyone who knows better) that although the tools used to program the
SEAforth chips are in Forth, that you really aren't programming in what
most would think as Forth. It's more like an assembly language that
just happens to have a Forth flavor. You see this in their preliminary
applications guide, where the user is told about tricks like saving
program memory by replacing a literal zero with a "dup dup xor"
sequence, carefully placing "." (NOP) to generate the most efficient
code, and synthesizing "-" from "+" and "not".

.



Relevant Pages

  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... Why do you continue to associate sociological babble with programming ... You wrote a C "compiler" that did not support typedef at all. ... > the string a single instruction, which scans a string for a character, ...
    (comp.programming)
  • Re: [EGN] Numerical Accuracy
    ... The advice worked because in fact the Microsoft compiler had a bug. ... The capabilities of the optimizer are not so ... The language standard itself says ... of "programming" as a nonprofession. ...
    (comp.programming)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... and just hone in on the stuff related to programming and this newsroup] ... moron that was taken from optimization which does hoist when to do so ... compiler design and optimization, including my 1976 text in graduate ... loop in a language in which the designers messed up, ...
    (comp.programming)
  • Re: Javas performance far better that optimized C++
    ... The compiler is extremely stupid. ... no memory leaks are guaranteed. ... However I have GC in my .NET programming. ... "C.9.1 Automatic Garbage Collection ...
    (comp.lang.cpp)
  • Re: Aspiring highest-order programmer
    ... book", Sherman's Programming and Coding for Digital Computers, was ... an IBM 7094 running IBSYS as an OS and with a Fortran compiler. ... Thus today I am confident that computer science students learn "all ... > long, very long, and not exactly focused on NP completeness). ...
    (comp.programming)