Search Results: "Chris Lamb"

26 May 2007

Chris Lamb: Pro Prolog is pro.

A lot of computer problems (and some puzzles) simply involve backtracking over the solution space and checking constraints, yet these can be fairly clunky to describe in imperative languages. Compounding this, the high cost of method calls in most VM and dynamic languages make any reasonably sane-looking implementation (read: recursive) rather slow. A much better idea is to use a language that makes this really easy, like Prolog: I have a Compiler Design exam in less than a weeks time, and a common question involves being given a number of definitions of compilers in terms of their source and target languages, along with the language the compiler itself is implemented in. The task is simply to work out whether it is possible to translate from a specified language to another. This is just two stanzas in Prolog:
can_translate(Src, Tgt, [L])   :- t_diagram(Src, Tgt, _, L).
can_translate(Src, Tgt, [H T]) :- t_diagram(Src, Via, _, H),
   can_translate(Via, Tgt, T).
Compilers can be then just be defined with
t_diagram(source, target, implemented in, name).
and querying the translation pipeline is done with
?- can_translate(source, target, Result)
(Modifying it so that it works with cycles isn’t very tricky, either.)

16 May 2007

Chris Lamb: A confession

Yes, it’s true:

3 May 2007

Chris Lamb: Final report complete!

Just submitted my third-year project. Was probably the longest document I will ever write:
$ wc -w  find ~/local/bzr/3yp/docs/report -name "*.tex"    tail -n1
19234 total
$
(If new readers are picking up the story late, in the final year of the Warwick Computer Science course, students are required to undertake a reasonably sized project. I chose to write a Java compiler in Python.) Actually writing the report was a bit more painful than I thought, dispite having collected and organised most of the data, references and interesting topics well in advance. I’ve nearly overcome some sort of writers-block-cum-nervousness issue though, which is good. I got a few interesting results: My backend system had a peephole optimiser to run on all code regardless of the input language and it seems like Sun’s javac seems to miss out on many really trivial optimisations, probably because the JIT takes care of any performance blackspots. Regardless, I plan to have a go at adding this into OpenJDK after my exams just as an excuse to hack on the Real Java. (I also did some register allocation, also beating javac, althought I didn’t really investigate way) I’ll have to wait for while due to University regulations anyway, but I’m not sure if the project code is really fit for public consumption yet, but I plan to rip out the silly Lisp implementation (and most of the Java one) leaving a rather fast and “enterprise-ready” Brainf*** compiler. :)

2 May 2007

Chris Lamb: April s search strings

This is clearly a meme now.

26 April 2007

Chris Lamb: Pimp your webpage

Every project needs a good webpage. This afternoon I spent a little while making Debian Live’s site a little easier on the eyes. It was my first experience with WML, which was interesting. Thanks to Christoph Haas for letting me use his stylesheet. In other news, last night I was elected Projects Officer for my University’s GLUG.

25 April 2007

Chris Lamb: Hi, Planet Debian.

In the upcoming holidays I’ll be working with Daniel Baumann on a graphical user interface to Debian Live thanks to the Google Summer of Code (I posted my full proposal to debian-live-devel if you want to read more). Thanks to Daniel for agreeing to be my mentor. This is my first post to Planet Debian, by the way. A few people might have met me at certain events, but if you haven’t I’m a kinda average hacker-type with a short attention span, long hair, broken sleeping patterns and above-average caffeine requirements. I’m currently a student at the University of Warwick and first started using Debian with “Slink”. If I’m missing anything, or you just want to say hi, please post a comment.

16 November 2005

Joachim Breitner: Lightweight Replacement for 111 lines of code

Chris Lamb has announced his gaim plugin “gaim-lightthink” both on his blog and on the thinkpad-linux mailing list. His plugin does basically the same thing as my gaim-thinklight plugin. I was a bit surprised to read that his plugin is supossed to be a lightweight replacement for mine, as he says on the code page.As he has not yet replied to my mail, I can only guess what he means - it’s probably not lines of code, I count 111 in mine and 128 in his. So I hoped he had found a better solution for letting the user write the /proc/acpi/ibm/light file, but he just requires the user to change permissions himself (on every boot, that is), while I install a suid program that does nothing but lets anyone write one of two strings to that file. Also, I think constructing a long line like “echo on > /proc/acpi/ibm/light; sleep .400; echo off > /proc/acpi/ibm/light; sleep .400;...; &” is not very lightweight compared to call the light controlling program directly from gaim, using gtk’s event loop for the delays. But maybe I’m missing something...BTW, I’m still looking for a sane way to let my plugin write to that /proc file. There should be a system wide list of files and permissions for virtual files (/proc, /sys), where packages like gaim-thinklight can register their needs. This file should then be worked off upon boot (or better, upon mounting of the respective file system).

Next.

Previous.