[Haskell] build an interpreter on top of GHCi?

Bernard Pope bjpop at cs.mu.OZ.AU
Thu Jan 27 02:13:41 EST 2005


On Thu, 2005-01-27 at 13:57 +0800, WANG Meng wrote:
> Hi All,
> 
> Does anybody has the experience to built an interpreter on top of GHCi?
> 
> What I want is to defined a my own interpreter as a Haskell module and
> load it into GHCi. So this new interpreter will be running on top of GHCi
> which accepts syntax extension of Haskell. For example:
> 
> Prelude> :l myInter
> Prelude> myInter> new language source
> Prelude> myInter> ...
> Prelude> myInter> exit
> Prelude>

Writing interpreters in Haskell is fun, for example you can check out my
baskell interpreter: http://www.cs.mu.oz.au/~bjpop/code.html
That is a small functional language with type inference and a REPL. It
loads in GHCi, and appears to work in a fashion similar to your above
sketch.

However I'm not entirely sure that's what you want to do. For example
you seem to be only interested in GHCi, and I wonder why that is so. Why
not Hugs, or why not compile the interpreter? Perhaps you want to make
an extension to GHCi? 

Cheers,
Bernie.



More information about the Haskell mailing list