[Haskell-cafe] Haskell on Android
Jason Dagit
dagit at codersbase.com
Thu Jun 18 01:26:23 EDT 2009
On Wed, Jun 17, 2009 at 9:53 PM, Vasili I. Galchin <vigalchin at gmail.com>wrote:
> Hello,
>
> Let me change the subject ... I think everybody understood my "thrust"
> but let me make more provocative. Don, please let me expose my ignorance for
> the greater good and time my personal scorn ;^) ... "EDSL" time => Embedded
> Domain-Specific Language?? If so, can you please be more specific! I don't
> mind to be a grunt for Haskell.
Yes, EDSL is Embedded Domain-Specific Language. Although, I'm not sure I
understand what you are asking. I looked at the wiki page which Conal
created and he does mention using an EDSL in Haskell to generate code.
Perhaps this is what you want to know more about?
There is a paper linked from the wiki page that should help a lot with
answering questions you have about the technique. For a simple example of
how it can work, I wrote a program called Autoproc that 'compiles' the
haskell EDSL into a procmail recipe. You can find the source code here:
darcs get http://projects.codersbase.com/repos/autoproc/
It's really not much code so it should be easy to wrap your mind around it.
I call the above code simple, but it works quite well and illustrates that a
little bit of Haskell can go a long ways :)
How it works is that the expressions you code up in Haskell build up values
which correspond to the abstract syntax, or your intermediate
representation. You can then transform that representation and do whatever
a compiler or translator would normally do and the target format is some
other language or machine code.
This technique allows you to reuse the facilites of the host language, such
as strong static typing and laziness, the parser, standard libs and so on.
It's a great way to prototype a language and work out the kinks before you
invest in making a stand alone implementation. And all that aside, it's
just plain fun.
I hope that helps,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090618/006697c2/attachment.html
More information about the Haskell-Cafe
mailing list