EDSL's using Filet-O-Fish of Barrelfish project

Hi All, I'd been looking for a mechanism to generate "C" from Haskell as EDSL - to develop an OS. In the process, I ran into the Barrelfish project ( http://www.barrelfish.org) - They seem to be using Haskell based "DSL generator" called Filet-O-Fish - http://www.barrelfish.org/fof_plos09.pdf It will take me some time understand Filet-O-Fish more but if any of the Haskell experts have already looked at it, I was wondering if I could use Filet-O-Fish to generate EDSL's for arbitrary things. For example, lets say, I wanted to write a EDSL for Linux's network drivers. Could I use Filet-O-Fish and generate a EDSL that allows me to write a driver in a really highlevel manner and then generate the "C" code for it? -- Regards, Kashyap

Hi,
On Sun, Feb 14, 2010 at 4:44 PM, C K Kashyap
For example, lets say, I wanted to write a EDSL for Linux's network drivers. Could I use Filet-O-Fish and generate a EDSL that allows me to write a driver in a really highlevel manner and then generate the "C" code for it?
That sounds perfectly reasonable to me. However, you write "generate a EDSL that allows me to [...]". Filet-o-Fish will not "generate" an EDSL for you. Filet-o-Fish will help you implement the *back-end* of your (E)DSL compiler. You still have to define a syntax and a semantics for your (E)DSL. FoF is here to bridge the gap from your (E)DSL semantics to C, by doing it for you. In Barrelfish, we have implemented the capability system this way: we have defined the syntax and semantics of a DSL for specifying capability systems, called Hamlet. Then, the Hamlet compiler back-end has been implemented with FoF, which allowed us, for example, to quickcheck some key property of the generated C code, by working at the (more friendly) FoF code level (assuming that FoF is "correct" ;-). For fun, we have implemented tic-tac-toe in the capability system. Each game state is represented by a capability, you can "retype" a capability from one to another iif this is a valid tic-tac-toe move. For a 3x3 board, that's more than 4.800 unique capabilities, which is quite a huge number of caps for an OS :-) You won't find that code in the official Barrelfish, though. Whereas this work was done in the specific context of Barrelfish, other people have designed DSLs for Linux. The examples I have in mind, related to your question are: * Devil [http://phoenix.inria.fr/index.php/projects/past-projects/devil]: a device interface language, but still quite low-level compared to what you're interested in ; * Bossa [http://bossa.lip6.fr/]: a DSL for specifying schedulers for Linux, which automatically turns the spec into code directly integrated in the Linux kernel. I had the opportunity to discuss with the designer of these systems and it is clear to me that this could be done with FoF as well. Hope this help, -- Pierre-Evariste DAGAND http://perso.eleves.bretagne.ens-cachan.fr/~dagand/

Thank you very much,
What would be your recommendation on how to get a grasp of FoF - would the
tic-tac-toe sample help - could you share that please?
Regards,
Kashyap
On Sun, Feb 14, 2010 at 11:27 PM, Pierre-Evariste Dagand wrote: Hi, On Sun, Feb 14, 2010 at 4:44 PM, C K Kashyap For example, lets say, I wanted to write a EDSL for Linux's network
drivers. Could I use
Filet-O-Fish and generate a EDSL that allows me to write a driver in a
really highlevel manner and then generate the "C" code for it? That sounds perfectly reasonable to me. However, you write "generate a EDSL that allows me to [...]".
Filet-o-Fish will not "generate" an EDSL for you. Filet-o-Fish will
help you implement the *back-end* of your (E)DSL compiler. You still
have to define a syntax and a semantics for your (E)DSL. FoF is here
to bridge the gap from your (E)DSL semantics to C, by doing it for
you. In Barrelfish, we have implemented the capability system this way: we
have defined the syntax and semantics of a DSL for specifying
capability systems, called Hamlet. Then, the Hamlet compiler back-end
has been implemented with FoF, which allowed us, for example, to
quickcheck some key property of the generated C code, by working at
the (more friendly) FoF code level (assuming that FoF is "correct"
;-). For fun, we have implemented tic-tac-toe in the capability system.
Each game state is represented by a capability, you can "retype" a
capability from one to another iif this is a valid tic-tac-toe move.
For a 3x3 board, that's more than 4.800 unique capabilities, which is
quite a huge number of caps for an OS :-) You won't find that code in
the official Barrelfish, though. Whereas this work was done in the specific context of Barrelfish,
other people have designed DSLs for Linux. The examples I have in
mind, related to your question are:
* Devil [http://phoenix.inria.fr/index.php/projects/past-projects/devil]:
a device interface language, but still quite low-level compared to
what you're interested in ;
* Bossa [http://bossa.lip6.fr/]: a DSL for specifying schedulers for
Linux, which automatically turns the spec into code directly
integrated in the Linux kernel. I had the opportunity to discuss with the designer of these systems
and it is clear to me that this could be done with FoF as well. Hope this help, --
Pierre-Evariste DAGAND
http://perso.eleves.bretagne.ens-cachan.fr/~dagand/ --
Regards,
Kashyap

Hi Kashyap,
What would be your recommendation on how to get a grasp of FoF
Well, you can read the PLOS paper first. Also, FoF is a literate code, so hopefully the learning curve will be less steeper. You should also take a look at the Fugu compiler literate code and, in less extend, the Hamlet compiler. They are sitting in ./tools/.
would the tic-tac-toe sample help - could you share that please?
Tic-tac-toe in the caps system was really nothing but a hack (for a demo). There is no pedagogical value in staring at it: it is just the file ./capabilities/caps.hl extended with approx. 4800 capabilities! Reading the official caps.hl is much more interesting, and, if you really want to, you will quickly see how you can implement your favorite board game in there. But don't! :-) Regards, -- Pierre-Evariste DAGAND

Thanks,
I'll follow your suggestion and get back with any doubts that I might have.
Regards,
Kashyap
On Sat, Feb 27, 2010 at 1:37 AM, Pierre-Evariste Dagand
Hi Kashyap,
What would be your recommendation on how to get a grasp of FoF
Well, you can read the PLOS paper first. Also, FoF is a literate code, so hopefully the learning curve will be less steeper. You should also take a look at the Fugu compiler literate code and, in less extend, the Hamlet compiler. They are sitting in ./tools/.
would the tic-tac-toe sample help - could you share that please?
Tic-tac-toe in the caps system was really nothing but a hack (for a demo). There is no pedagogical value in staring at it: it is just the file ./capabilities/caps.hl extended with approx. 4800 capabilities! Reading the official caps.hl is much more interesting, and, if you really want to, you will quickly see how you can implement your favorite board game in there. But don't! :-)
Regards,
-- Pierre-Evariste DAGAND
-- Regards, Kashyap
participants (2)
-
C K Kashyap
-
Pierre-Evariste Dagand