# Writing a domain specific macro processor in ruby

**URL:** <https://www.ruby-forum.com/t/writing-a-domain-specific-macro-processor-in-ruby/194600>\
**Category:** Ruby\
**Created:** [September 7, 2010, 6:25pm UTC](https://www.ruby-forum.com/t/writing-a-domain-specific-macro-processor-in-ruby/194600 "2010-09-07T18:25:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Handy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/3ab097/32.png) [@Handy\_G](https://www.ruby-forum.com/u/Handy_G)\
**Post date:** [September 7, 2010, 6:25pm UTC](https://www.ruby-forum.com/t/writing-a-domain-specific-macro-processor-in-ruby/194600/1 "2010-09-07T18:25:35Z")

</div>

I’m thinking of something like the m4 processor ( of autotools fame or  
infamy ), but with only a few domain specific built-in macros.

Can anyone offer some helpful hints?

---

<div class="post-metadata">

**Author:** ![Handy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/3ab097/32.png) [@Handy\_G](https://www.ruby-forum.com/u/Handy_G)\
**Post date:** [September 7, 2010, 7:06pm UTC](https://www.ruby-forum.com/t/writing-a-domain-specific-macro-processor-in-ruby/194600/2 "2010-09-07T19:06:20Z")

</div>

Handy G. wrote:

> Can anyone offer some helpful hints?

Look at existing text/template expansion projects first, e.g.

- erb / erubis
- liquid
- moustache

Google “ruby templating” for more. Some are geared towards generating  
HTML, but others are more general-purpose.

---

<div class="post-metadata">

**Author:** ![Handy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/3ab097/32.png) [@Handy\_G](https://www.ruby-forum.com/u/Handy_G)\
**Post date:** [September 7, 2010, 7:14pm UTC](https://www.ruby-forum.com/t/writing-a-domain-specific-macro-processor-in-ruby/194600/3 "2010-09-07T19:14:10Z")

</div>

On Tue, Sep 7, 2010 at 9:15 AM, Handy G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’m thinking of something like the m4 processor ( of autotools fame or  
> infamy ), but with only a few domain specific built-in macros.
> 
> Can anyone offer some helpful hints?

What is the application? What is the target language?

---

<div class="post-metadata">

**Author:** ![Handy\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/3ab097/32.png) [@Handy\_G](https://www.ruby-forum.com/u/Handy_G)\
**Post date:** [September 7, 2010, 7:20pm UTC](https://www.ruby-forum.com/t/writing-a-domain-specific-macro-processor-in-ruby/194600/4 "2010-09-07T19:20:37Z")

</div>

On Sep 7, 10:13 am, Caleb C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Tue, Sep 7, 2010 at 9:15 AM, Handy G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I’m thinking of something like the m4 processor ( of autotools fame or  
> > infamy ), but with only a few domain specific built-in macros.
> 
> > Can anyone offer some helpful hints?
> 
> What is the application? What is the target language?

and what’s wrong with m4?
