Code and Bugs

Coding things

Tag: compilers

Well, I’m back

Nearly an year has passed since I last wrote on this blog with a specific plan in mind. There were several articles in the meantime but very few and written because of a moment’s hunch.

I’m back now, even if for a short period of time.

This article is divided into two parts (I’ll try to make them be under 500 words each):

Each of the two parts has a separate page.

Pages: 1 2 3

A semester of coding

The last semester was a very busy one at my faculty. This is the main reason why I failed to update this blog. However, now that I have free time again, I’ll present some of the coding assignments that I’ve done during the last semester.

Read the rest of this entry »

Compiling GHC from sources

I’ve decided that the best way to learn about the internals of GHC is to actually look at it’s source code in parallel with some experiments. This is the first part of a series of articles related to some GHC experiments, maybe going towards a ghcd command. But, until then, we have much work to do.

Read the rest of this entry »

Haskell Compiler with LLVM backend

We know that GHC (The Glorious Haskell Compiler) can output it’s machine code via assembly or via C. Someone once asked on Haskell-cafe if LLVM couldn’t be used, taking into account that once you get your code to LLVM it will be very easy to deploy it to several platforms. Though, a year ago, the answer was discouraging, a BSC Thesis by David Therei contradicted this. Right now, we can write very fast code in Haskell using the LLVM backend. If you need a benchmark, see here an example.

Now, a short review on the thesis. Starting with a few details on compiler design and quickly dwelling into GHC, David presents his work on implemententing the LLVM backend for GHC. His thesis ends with some short evaluations but I enjoyed the above example more.

His paper has enough code examples to make everything clearer to any begginer into the topic of compilers and I recommend reading it while it is still open to anyone wanting to work on this area.

To me, reading this paper was like descovering a hidden treasury. Had I read it sooner I wouldn’t make several mistakes in my Verilog compiler (the third article will be written shortly after this post).

Formal Languages and Books

I’ve read two books in the last days. Both are related to Formal Languages, Automata Theory and Compilers. This will be another review article.

Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.