[Haskell-cafe] Generating Haskell Code out of Haskell AST (GHC API)
Daniel Trstenjak
daniel.trstenjak at gmail.com
Fri Jul 19 12:08:30 CEST 2013
Hi John,
> Alan - I do NOT want to generate Haskell code. I want only to generate AST
> and compile it.
> The question about generating the code was only to have a "debugging tool"
> - to see if the generated AST is good - I wanted to generate the Haskell
> code only to check if its correct, but normally I would not do it, because
> it makes no sense to generate AST -> code -> AST (by GHC) again etc :)
> Additional - I want to connect to GHC's type-checking also and translate
> the errors to be appropriate to my language syntax - so maybe the pure GHC
> API is the best way to go?
I don't know what kind of language you're writing, but I don't think
that this is the easiest approach.
Just trying to convert a GHC error in something meaningful for your
language sounds like a quite painful undertaking, which will end
in some big heuristic algorithm.
I think, that getting good and meaningful errors for your language you
will need to do it by yourself. The result will be easier to maintain
and extend.
I don't quite understand why you're thinking that GHC is at all the
right tool. Well, I don't know exactly what you're really trying to do,
but have you already looked at LLVM (http://llvm.org/)?
Greetings,
Daniel
More information about the Haskell-Cafe
mailing list