[Haskell-cafe] Compilers: Why do we need a core language?
Joachim Breitner
mail at joachim-breitner.de
Tue Nov 20 17:36:51 CET 2012
Hi,
Am Dienstag, den 20.11.2012, 06:54 -0500 schrieb citb at lavabit.com:
> I know nothing about compilers and interpreters. I checked several
> books, but none of them explained why we have to translate a
> high-level language into a small (core) language. Is it impossible
> (very hard) to directly translate high-level language into machine
> code?
I would expect that even if you were to implement a compiler for full
Haskell itself, you would end up generating a core language. E.g, where
clauses can be implemented using let. So after you have implemented let
you are likely to not copy the code but rather transform your where
clause into a let clause. And alas, you suddenly have introduced a core
language (Haskell without where clauses). This way you will end up with
a very reduced subset of Haskell.
Then you might also notice that some features are similar to implement
and you can merge the code if you add some feature to your language,
making it a bit more expressive. Then your core language will be more
than just a subset of Haskell.
As you can see, you will have a hard time preventing yourself from
introducing a core language.
Greetings,
Joachim
--
Joachim Breitner
e-Mail: mail at joachim-breitner.de
Homepage: http://www.joachim-breitner.de
Jabber-ID: nomeata at joachim-breitner.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121120/cccb8729/attachment.pgp>
More information about the Haskell-Cafe
mailing list