Boost logo

Proto :

Subject: Re: [proto] talking proto
From: Eric Niebler (eric_at_[hidden])
Date: 2010-07-17 00:03:25


On 7/16/2010 11:15 PM, Marcin Zalewski wrote:
> On Fri, Jul 16, 2010 at 09:19, Eric Niebler <eric-xT6NqnoQrPdWk0Htik3J/w_at_[hidden]> wrote:
>>
>> I am not familiar with other technologies used to implement DSEL in
>> other languages. Are you? Can you point me to some information or
>> describe the other efforts in this area? I used little more than my own
>> needs and my knowledge of compiler construction toolkits to guide the
>> design of proto. Maybe there are other good ideas out there we can steal.
>
> Haskell people have Template Haskell [1]. It allows one to freely
> generate syntax trees. One can have DSLs that "hijack" Haskell's
> syntax, assigning it non-standard semantics. Oleg Kiselyov has a very
> simplified example of tuning an interpreter into a compiler [2].
>
> It would be great if we could write DSLs in C++ at compile time, as
> one can use Template Haskell to write DSLs in Haskell (or Lisp DSLs in
> Lisp, and so on). But, until then, we have proto. :)
>
> Cheers,
> Marcin
>
> [1] http://www.haskell.org/haskellwiki/Template_Haskell
> [2] http://okmij.org/ftp/tagless-final/#tc-GADT

Thanks for the links. Some good bedtime reading for me. But obviously if
C++ is the host language, then a DSEL's syntax is necessarily
constrained to that of C++. That rules out nifty tricks like
meta-programming C++ in C++ a-la Lisp or Haskell. You can't make that
pig fly. Maybe the answer is to just use Haskell, but that's not
something I can tell proto's users. ;-)

I guess my question is: what ideas from these languages/DSEL toolkits do
we have a reasonable chance of cherry-picking in proto? Proto has
grammars and semantic actions (transforms) because I've found them
useful in Spirit and Antlr. Someone on the dev list brought up Van
Wijngaarden grammars. I haven't tried to implement them yet (mostly
because I don't understand them). There are probably lots of other good
ideas out there.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com