[stack] ANN: Concatenative Macro Processor
"Mark W. Humphries" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Minimac (http://freshmeat.net/projects/minimac-macro-processor) is a
minimalist, general purpose text macro processor.
It uses an explicit argument stack, and user functions are defined by concatenation.
The software is currently in alpha release.
Example: 99 bottles of beer (http://99-bottles-of-beer.net/)
`drink! ( u -- ) `{continue}${#}
this-many-bottles of beer on the wall, this-many-bottles of beer.
Take one down and pass it around, fewer-bottles of beer on the wall.
{repeat}`
`oh-no! ( -- ) `No more bottles of beer on the wall, no more bottles of beer.`
`please! ( u -- u ) `{#}
Go to the store and buy some more, this-many-bottles of beer on the wall.`
`this-many-bottles ( u -- u ) `[{dup} 0& ~no more bottles~& {case} 1& ~1 bottle~& {case} {.} ~ bottles~]`
`fewer-bottles ( u -- u-1 ) `{--}$this-many-bottles`
99& drink!
oh-no!
99& please!
Cheers,
Mark Humphries