ANN: Concatenative Macro Processor

View: New views
3 Messages — Rating Filter:   Alert me  

ANN: Concatenative Macro Processor

by MarkWH :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


Re: ANN: Concatenative Macro Processor

by eas lab :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Just to keep the pipes exercised
 [I suspected that I'd been cut-off of cat-list
 [what's happening in the 1st-world/N-hemisphere
   'for' no cat-list-traffic ?] ]

I'm asking what's Minimac's minimal-syntax ?

I/we don't just go off to httpS on a whim.
ANNs should contain minimum info to justify
further effort investment.

How would it:
remove all sequences of lines,
  starting from <string1> upto <string2> ?

== TIA.






On 6/23/09, Mark W. Humphries <mwh@...> wrote:

> 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
>
>

Re: ANN: Concatenative Macro Processor

by MarkWH :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

--- In concatenative@..., eas lab <lab.eas@...> wrote:

>
> Just to keep the pipes exercised
>  [I suspected that I'd been cut-off of cat-list
>  [what's happening in the 1st-world/N-hemisphere
>    'for' no cat-list-traffic ?] ]
>
> I'm asking what's Minimac's minimal-syntax ?
>
> I/we don't just go off to httpS on a whim.
> ANNs should contain minimum info to justify
> further effort investment.
>
> How would it:
> remove all sequences of lines,
>   starting from <string1> upto <string2> ?
>
> == TIA.

Hi,

Thanks for your questions.

Minimac has almost no syntax, basically a set of special characters that trigger behaviors (quoting, escaping, naming, compiling, etc...) and a dictionary (i.e. symbol table) of built-in macros that is extended at runtime with user macro definitions. See the draft manual for more info: http://code.google.com/p/minimac/wiki/manual

As to your second question on removing sequences of lines, minimac is a macro processor similar in purpose to m4, i.e. it expands macro directives contained in a source file, what you're describing is a job better suited for a stream editor.

Cheers,
 Mark Humphries
 http://freshmeat.net/projects/minimac-macro-processor