"Marcel Hendrix" <mhx@[EMAIL PROTECTED]
> wrote in message
news:38331417223559@[EMAIL PROTECTED]
> "Rod Pemberton" <do_not_have@[EMAIL PROTECTED]
> writes Re: I found a FORTH
stack optimzer, but could use a better version.
>
> > I ran across an interesting optimizer for FORTH stack words in java by
Ram
> > Janovski, and Vassilii Khachaturov, dated 2004, here:
>
> > http://black.cs.bgu.ac.il/forth-opt
>
> > Depending on which FORTH stack words you select, it'll attempt to
generate a
> > optimized definition using the input set of words.
>
> I fail to see what's being "optimized" here. In what sense is the result
> "optimal?" It seems to help in writing code that never should get
written
> in the first place, or that should use locals (e.g. when writing for a
GUI
> where this style can't be prevented).
>
I think their goal, on one of the linked to pages, was to find the minimal
sequence of FORTH words for a given stack conversion using some algorithm
of
Dijkstra's. E.g., when all sup****ted words are enabled (I wasn't doing
this...), to go from (ab) to (ababba), or (ab -- ababba), their result is:
Transforming ab ==> ababba
2DUP ( ab -- abab )
2DUP ( abab -- ababab )
SWAP ( ababab -- ababba )
Sorry, I wasn't using their optimizer for FORTH, although that's
(apparently) what it was written for. My use is for a optimizing a
compiler, but it could be useful for a FORTH implementor to optimize the
underlying assembly... Originally, I was looking for ways to reduce
FORTH-like stack operations to simple operations which could correspond to
x86 assembly for a single stack, not a double stack environment like
FORTH.
So, I was checking how each primitive, word, or verb, could be
(re)written.
E.g., DUP, DROP, OVER, PICK, "PLACE", >R, R>, R@[EMAIL PROTECTED]
etc. correspond nicely
to
x86 instructions, but other ones necessary for stack operations, such as
ROT, TUCK, SWAP, ROLL don't. Those operations relocate or move a block of
data on the stack, even if small. I'd like to avoid them. SWAP
corresponds
nicely for register operations, but not stack operations... So, I was
using
their stack optimizer to see how each primitive could be written using a
small set x86 compatible primitives, words, verbs, like these:
1) >R,R>,R@[EMAIL PROTECTED]
2) DUP,DROP,OVER
3) DUP,DROP,TUCK
4) DUP,DROP,ROT
etc.
[links]
Thanks for the links. I'll take a look.
Rod Pemberton


|
53 Posts in Topic:
|
"Rod Pemberton" |
2008-01-06 00:26:01 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 09:22:17 |
|
"Rod Pemberton" |
2008-01-06 04:37:47 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 11:00:53 |
|
"Rod Pemberton" |
2008-01-06 06:10:48 |
|
"Rod Pemberton" |
2008-01-06 06:24:17 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 12:58:34 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:27:20 |
|
Coos Haak <chforth@[EM |
2008-01-06 21:16:07 |
|
"Ed" <nospam |
2008-01-07 17:51:08 |
|
Albert van der Horst < |
2008-01-07 17:22:03 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 13:00:32 |
|
none <""jan\ |
2008-01-06 14:07:31 |
|
mhx@[EMAIL PROTECTED]
(M |
2008-01-06 15:27:04 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:32:53 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:05:30 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-06 13:42:55 |
|
"Rod Pemberton" |
2008-01-06 06:09:25 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-06 13:46:06 |
|
"Rod Pemberton" |
2008-01-06 18:25:08 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-07 10:58:44 |
|
"Rod Pemberton" |
2008-01-07 21:39:25 |
|
"Rod Pemberton" |
2008-01-07 22:57:58 |
|
Albert van der Horst < |
2008-01-08 08:13:03 |
|
"Rod Pemberton" |
2008-01-08 05:07:03 |
|
Albert van der Horst < |
2008-01-08 18:26:32 |
|
Alex McDonald <blog@[E |
2008-01-08 03:04:52 |
|
Roelf Toxopeus <these3 |
2008-01-06 15:24:29 |
|
winston19842005 <bjjly |
2008-01-06 10:13:11 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:01:26 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:52:02 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 08:54:01 |
|
Bernd Paysan <bernd.pa |
2008-01-06 18:34:43 |
|
helmwo@[EMAIL PROTECTED]
|
2008-01-06 10:27:48 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 13:26:05 |
|
Bernd Paysan <bernd.pa |
2008-01-06 23:02:25 |
|
kenney@[EMAIL PROTECTED]
|
2008-01-07 09:47:13 |
|
foxchip <fox@[EMAIL PR |
2008-01-06 13:43:00 |
|
Jenny Brien <jennybrie |
2008-01-08 14:06:38 |
|
Bill <bill@[EMAIL PROT |
2008-01-08 21:20:47 |
|
"Rod Pemberton" |
2008-01-09 04:57:34 |
|
Jenny Brien <jennybrie |
2008-01-10 09:50:29 |
|
"Rod Pemberton" |
2008-01-11 03:34:02 |
|
"Jenny Brien" & |
2008-01-11 17:49:07 |
|
"Rod Pemberton" |
2008-01-12 04:31:21 |
|
astrobe <fdubois76@[EM |
2008-01-14 09:31:33 |
|
foxchip <fox@[EMAIL PR |
2008-01-19 10:11:10 |
|
stephenXXX@[EMAIL PROTECT |
2008-01-20 15:33:32 |
|
ygrek <ygrek@[EMAIL PR |
2008-01-06 12:31:47 |
|
"Rod Pemberton" |
2008-01-06 17:58:45 |
|
anton@[EMAIL PROTECTED]
|
2008-01-06 18:22:00 |
|
"Rod Pemberton" |
2008-01-06 18:18:56 |
|
ygrek <ygrek@[EMAIL PR |
2008-01-07 09:05:18 |
|