[Haskell] Scripting language: is Haskell a good choice?
GK at ninebynine.org
Thu Jan 26 13:16:59 EST 2006
I used Haskell to implement a kind of scripting language, and it seemed most
usable to me.
I particular, I liked the fact that it was possible to write a Parsec parser
that "compiles" script language expressions directly into executable Haskell
functions, avoiding the need for a separate interpretation layer, and because of
this I think performance is probably quite respectable. Higher order functions
are, I believe, a real boon for this kind of work.
My work in this area is a bit stale, but can be found at:
The particular module that "compiles" script language to functions is here:
The parser assembles a list of function that uses the "SwishState helper
functions" as primitives, and operate in the SwishStateIO monad - an I/O monad
that also incorprates some specific state that is used by my interpreter.
Upper-level functions are 'parseScriptFromString' and 'script'.
Jules Jacobs wrote:
> I would like to create a scripting language, similar to Ruby, Perl and
> Python. Pugs, written in Haskell, is a Perl6 implementation. Is Haskell
> a good choice for me? I have no experience with Haskell (yet), but I
> like the concept of functional programming. Because Haskell will
> probably be too slow for the final implementation, I will have to
> rewrite it in C or maybe D. Haskell can be very useful as a
> test/prototype implementation, where speed is not very important. But
> will I be able to create a clean, and easy to understand implementation
> in Haskell? The scripting language will be object oriented, and
> imperative. Is that a problem because Haskell is functional, or is there
> be an obvious and nice way to implement an imperative scripting language?
> The language is very dynamic, and the source-tree needs to be in memory
> because it is modifiable at run-time.
> Would it be good to do this in Haskell, and port it to C if I like the
> implementation, or start in C? Keep the parser/lexer for the source code
> in Haskell, but port only the interpreter to C?
> What would be a good place to start? I am reading Yet Another Haskell
> tutorial, and I've read the first 6 of two dozen lessons in Haskell.
> What to do next, practice/read more/start with the implementation of the
> scripting language?
> Thanks in advance,
> Haskell mailing list
> Haskell at haskell.org
More information about the Haskell