Archive for the ‘Computing’ Category.

Done with the first exam!

I had my first exam in this semester today, I’ve passed DAIMI:dOvs — the compilation course — with the grade 13! The exam went much better than I had hoped, let me explain why…

The main part of DAIMI:dOvs is to write two major programs: a compiler in ML that will compile a dialect of Scheme called DAIMI-Scheme into bytecode; and a virtual machine written in C which will execute the bytecode. Using this compiler and VM we then have to BootStrap a compiler given to us by our lecturer Olivier Danvy written in DAIMI-Scheme.

As the project went along Lars Petersen ended up writing a majority of the compiler and Thomas Mølhave ended up writing and designing most of the VM, especially the rewritten (and much better) second version. I coded a bit here and a bit there, made some infrastructure such as a cool Makefile, began the report and so on… The result was that I didn’t really have any major code which I could say: this is my code — I’ve designed it and I know every little detail in it. Both Lars and Thomas could do that with the compiler and the VM, respectively.

At the exam I started talking about garbage collectors — a pretty easy subject with lots to talk about. But that question was just for warming up. The real questions would come afterwards — Danvy started with a question about how one could change the parameter passing semantics in DAIMI-Scheme from eager to lazy evaluation. And that was just soo lucky, for I had in fact been looking at just that: I had spend the last couple of days just before the deadline trying to implement this as an extra feature in our compiler — Danvy picked the one bit of code that was mine!

So I started talking about lazy evaluation, first I defined it and compared it against the normal eager evaluation we’re all familiar with from languages like Pascal, C, Scheme, ML, etc. Lazy evaluation can be simulated “by hand” in most functional languages, but it’s builtin in a language like Haskell. I wanted to have our compiler compile a program like

(define first (lambda (a b) a))
(first (quotient 4 2) (quotient 2 0))

into a program that behaves like this one

(define quotient (let ([original quotient])
                   (lambda (a b)
                     (original (a) (b)))))
(define first (lambda (a b) (a)))
(first (lambda () (quotient (lambda () 4) (lambda () 2)))
       (lambda () (quotient (lambda () 2) (lambda () 0))))

This program will, when compiled like any other program, run without the normal runtime error caused by the division by zero in the second argument because the evaluation of the argument has been delayed.

I fiddled with this for a couple of days, and managed to get 270 out of 300 tests working, including the example above. But it was never prefect, but it was certainly good enough so that I could talk about it to the exam :-)

After having talked about the lazy extension, we talked abit about our optimizations — it turned out that there is a subtle error in it because our inliner will inline strings in the code. The inlined strings will then be assigned different locations in the store, making the eqv? function say that they are different, when infact they should be the same:

(define x "foo")
(eqv? x x)

is turned into just

(eqv? "foo" "foo")

which suddenly returns #f, that is, false, when it should return true. I could understand the problem when the censor explained it to me, but I quickly blamed Lars for it… :-)

The next exam will be a written exam in DAIMI:dSprogSem the 13th. Wish me luck!

It’s done.

We (Thomas Mølhave, Lars Petersen, and I) handed in our code for the DAIMI:dOvs project very early in the morning last Friday, so the first phase is now over. Our compiler compiles any DAIMI-Scheme program you throw at it, and our VM runs any DAIMI-Scheme Bytecode program we could find, and it does it fast. So we’re very happy with the programs we’ve made in the project.

We now have until Friday the 12th to write a big report, so please don’t expect any updates on these pages until that time. And to make things worse, then we also have to deal with a compulsory exercise in DAIMI:dSprogSem which has a deadline on Wednesday 10th. So, I’m not bored, not bored at all…

Stupid spam

I’m still getting tons of spam sent to my address(es) at GimpsterDotCom, but none of it gets through thanks to the extremely accurate POPFile filter that I use.

POPFile is using good oldfashioned statistics to sort my mail into different buckets — you’re not limited to a simple spam/non-spam classification, POPFile can sort mail into any number of buckets.

I’ve now had 19,275 mails sent through POPFile, and I’ve had to correct it 16 times. This gives an accuracy of 99.92%(!). And what is more extreme, is that it tells me that I’ve received an average of 292 mails each day in the last two months…

Now for the stupid spam that just caught my eye, here’s the headers:

Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: (qmail 20512 invoked by uid 506); 4 Nov 2003 05:42:30 -0000
Received: from [email protected]
by sky.netsite.dk by uid 503 with qmail-scanner-1.20rc1
(clamuko: 0.60. Clear:RC:0:.
Processed in 0.06725 secs); 04 Nov 2003 05:42:30 -0000
X-Qmail-Scanner-Mail-From: [email protected] via sky.netsite.dk
X-Qmail-Scanner: 1.20rc1 (Clear:RC:0:. Processed in 0.06725 secs)
Received: from 216-187-212-197.ded.btitelecom.net (HELO exchange.jano.net) (216.187.212.197)
by mail.netsite.dk with SMTP; 4 Nov 2003 05:42:30 -0000
Received: from smtp0281.mail.yahoo.com ([211.158.48.239])
by exchange.jano.net with Microsoft SMTPSVC(5.0.2195.6713);
Mon, 3 Nov 2003 15:59:29 -0500
Date: Mon, 3 Nov 2003 20:56:38 GMT
From: “wilda “<[email protected]>
X-Priority: 3
To: [email protected]
Subject: $RANDOMIZE

Apparently they spammers cannot even get their filthy software to work correctly… That’s all for now, see ya!

No news for a month… what will come next?

As you’ve all undoubtfully noticed, then I haven’t updated GimpsterDotCom for little over a month now — I’ve simply been doing other things.

I have for example been working on our DAIMI:dOvs project with Lars Petersen and Thomas Mølhave. We’re asked to write a compiler in ML which will be used to compile a subset of Scheme called DAIMI-Scheme into a bytecode format.

The bytecode will be executed by a virtual machine, written in C. We’ve done with most of the VM, except for the garbage collector, and we’ve (well actually Lars Petersen has) just begun to look at writing the compiler.

More down-time for GimpsterDotCom

Some of you may have noticed that GimpsterDotCom were down for some hours yesterday — it wasn’t my fault this time :-)

The problem was a complete lack of power in the eastern part of Denmark including the southern of Sweden. The blackout started with a Swedish powerplant and then spread to all of southern Sweden. The two major Danish islands Fyn and Sjælland are connected to a Nordic electrical grid so when the voltage droppen in Sweden, then it also affected those parts of Denmark. GimpsterDotCom is hosted by NetSite which is located in Brøndby on Sjælland so my server went down together with everything else over there — I live in Århus in Jutland which weren’t affected.