Re: [stack] adding construction to factor
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Jan 4, 2009, at 11:16 AM, Christopher Diggins wrote:
> This looks like line noise to me. Either I'm dense, or the code could
> benefit from some comments.
I think the first half (up to and including the definition of
'construct') should be fairly straightforward. If it helps, 'with-
datastack' is the same as Joy's 'infra', the 'Narray' words group N
elements on the stack into an array, and '[ ] each' is a gross way of
putting all of the elements in an array onto the stack.
The second half just makes this:
[( f g , h i )]
parse to this:
{ [ f g ] [ h i ] } construct
How it does that, I'm not exactly sure. It was much trial and error
modifying the definition of '[' to suit my needs. I'd not written a
parsing word in Factor before, so perhaps there's a better way to do it.
- John