You are hereblogs / karltk's neck of the woods
karltk's neck of the woods
FOSDEM 2008
I'm going to FOSDEM again this year. A bunch of old friends will be coming, so the opportunity is too good to pass up. Also, since I'll be in Paris at the time around FOSDEM, travel is both fast and reasonably cheap. (Three cheers for high speed trains.)
If you're interested in meeting me there, don't hesitate to fire off an e-mail. There's no Gentoo room this year, so I'll be hanging around elsewhere. I'm bound to drop by the Free Java devroom, for sure:) Another gang I'm anxious to meet again are the Nix people.
New dissertation page and other Stratego updates
Martin recently got his PhD . It's very well deserved. I've seen first hand how serious and focused he's been for the last 4+ years.
Inspired by his didactical skills, I decided to rearrange my own dissertation page so that the individual chapters of my dissertation are easily downloadable.
Since I don't expect anybody to have neither the time nor the inclination to read the entire thesis from start to finish, Martin's idea of making it available as a split download makes a lot of sense.
Having done this, I got inspired to continue with spring (winter?) cleaning on a lot of other pieces of my PhD work.
I've set up an Ant Ivy repository for Spoofax. This means that you are now able to check out the various Spoofax subprojects from the source code repository and expect each subproject to compile separately, since all its dependencies will be fetched from my Ivy repo. Some of the subprojects require Eclipse. For those, you must run a script, fetch.sh, which will pick out the necessary jars from your Eclipse installation. It would best to have this repo hosted along with the rest of Stratego/XT, since it's definitely part of the Stratego/XT umbrella, but the new infrastructure in Delft is still being set up, I've been told.
Trying my hand as a webmonkey, I've decided to upload new Spoofax pages with a revamped design.
With those things out of the way, I'm now working on a reflection API for Stratego/J so that we may easily instantiate Java objects and call methods on them from Stratego scripts. This is needed for another project I'm cooking. However, I keep running into the lack of a fully interactive Stratego interpreter on the JVM, and that's a very itchy spot just now...;)
It finally died
My laptop hard drive has been limping along for the last month and a half, clearly spinning its last cycles. Occasionally, it would stop responding to IDE commands, and the syslog (if I were lucky enough to be watching it as this happened, or have dmesg in my cache just then) would fill up with failed DMA requests and messages that the kernel was attempting to reset both the bus and the drive, to no avail.
I've taken a couple of backups -- I find that I cry less often now that I backup my data more frequently -- which will be recovered once a new system is back up. And here lies a conundrum: I've ordered a replacement laptop, because, let's face it, my trusty x31 is no longer as hip and trendy as it used to be. However, after digging in my drawers, I discovered that I have a 60GB 7200rpm drive lying around (the first of the Hitachi 7200rpm Travelstar series).
Since it will still be a couple of weeks before the replacement laptop will be here, and especially since I'll be in France by then (if all goes according to plan), I've decided to do a partial restoration on the x31 with the 7200 rpm drive. It'll be interesting to see how much more of the battery this guy eats. I know already that it will run a lot hotter, and it's also making considerably more noise. However, it's also a bit more responsive than the old 4200 rpm drive, so all in all, it's not a total loss.
This would be an excellent opportunity to try out a new distro. I feel it's about time. However, I fail seeing any interesting newcomers. Perhaps I'm just not paying enough attention. Or perhaps Ubuntu is still getting a disproportionate amount of the limelight. I've looked into (Open)Solaris, but apparently suspend doesn't seem to work yet, making it a no-go. I'll keep an eye out for any improvement in this area, however.
Moving complete
We (Håvard and me) just finished moving. We now live next to the Brann football stadium (ugh!). Not entirely ideal, but it's part of a longer-term plan of securing a cheap, high standard apartment smack in the middle of town. Let's hope that gambit pays off.
Our new apartment is comparatively smaller, more expensive and not as nice as our previous one. The only upside so far is that my room got bigger, brighter and warmer, and I pay less (which means that Håvard pays more -- oh noes!). Oh, and there's a fireplace in it. We even bought firewood yesterday.
I guess we'll invite people for a house warming party next weekend. We just have to tidy up a bit first. I still have a couple of crates on my floor left to empty.
Summer Job Hunting
With my comp.sci PhD finished, printed and published, I'm now back to being a full-time medical student. It's really rewarding and fun -- being an introvert geek, I've learned a lot about how I relate to other people by being shoved into a room with a patient who expects me to talk to him/her about the most intimate details of his/her situation. Alas, being a student doesn't pay at all.
I've still some money left from earlier jobs, and I live quite comfortably, but prudence (and interest) requires me to look for a job this summer as well. If all pending exams go well, I'll get my temporary license at the end of the spring semester, which means I can apply for work as a hospital doctor during the summer. There's no denying that this would be quite a lot of fun, but I'm not all that hopeful -- the competition to get hospital jobs seems fierce, and I've not been a star performer when it comes to medicine, I'm sad to say (but hopefully things will pick up now that I can focus on it).
For these reasons, I'll probably also be looking around for comp.sci jobs as a backup because I'm fairly good at it, it pays well, and it's usually a lot of fun. Also, it's easier to get jobs abroad, even in countries where you don't speak the native language fluenty:)
It's time to officially retire
I've not found the time to do any useful work on Gentoo for around 1.5 years, and I don't see that situation changing in the near future. It all comes down to motivation, of course, and I'm motivated a lot more by other projects and communities these days, I must admit.
I'll avoid discussing the whole community attrition we've had in the later years, but there's no denying that this has been a major component in my loss of motivation for working on Gentoo.
That being said, I've met and worked with some great people in this community, and I'm eternally grateful for that -- you know who you are.
To all of you still hanging in there: take care, and have fun.
Update: it's done.
Stratego Java backend in progress
It's been rather quiet on the northern front for quite some time. I've been mostly busy with diagnosing old ladies with chest pain of late, and trying to make heads and tails of the horrible electronic health record system at the hospital. Sheesh.
Anyway, today I found time to do some compiler hacking. It feels great, as always! I resurrected the strc-java project -- a Java backend for the Stratego compiler. After a couple of hours of fiddling around, I now have an extremely rudimentary runtime up and running, and the compiler can compile simple build expressions properly.
Given the simple strategy
main = !Foo(1,2)
the following Java code is produced:
public static class main_0_0 extends Strategy
{
public final static main_0_0 instance = new main_0_0();
public ATerm apply(ATerm term)
{
try
{
{
ATerm[] b_0 = new ATerm[2];
{
ATerm c_0 = atermFactory.makeInt(1);
b_0[0] = c_0;
}
{
ATerm d_0 = atermFactory.makeInt(2);
b_0[1] = d_0;
}
ATerm a_0 = atermFactory.makeAppl(atermFactory.makeAFun("Foo", 2, false), b_0);
term = a_0;
}
}
catch(Failure f)
{
return null;
}
return term;
}
}
There are a number of unnecessary blocks in the above code fragment, but that's an artifact of the way I wrote the Java code templates. I'll see if I can't get rid of them eventually.
I've spent some time hacking about in order to get closures working without too much overhead. I think the current scheme will work, but will require a bit of sophistication and context-awareness in the code generator.
You can see the scheme in the example above. Every strategy is compiled to its own class, with an apply method. The signature for this method is not fixed. Rather, the number of strategy and term arguments may vary. The last argument is always the current term. Every class has a singleton instance, called instance. This is how we get the pointer. All context information that's required will have to be passed in, through the argument list.
There are in principle two possible schemes for passing in arguments. The first is to do as Stratego/J (the Stratego interpreter for Java): use two arrays, e.g. ATerm apply(Strategy[] svars, ATerm[] tvars, ATerm currentTerm). This costs two calls to new (in the general case) for every strategy invocation. Not very appealing.
The other possibility is to sequence the strategy and term arguments in the argument list, e.g.:
ATerm apply(Strategy s0, Strategy s1, ATerm t0, ATerm t0, ATerm currentTerm)
The problem here is that the arity of s.apply() is not fixed. We really have:
ATerm apply(Strategy<x0,y0> s0, Strategy<x1,y1> s1, ATerm t0, ATerm t0, ATerm currentTerm)
where x and y are the strategy and term arities, respectively. If we were generating C++ code, we could just use integers here. In Java, we'll have to insert real types. I'm tempted to use enums, and manually define the types N0 through N31. Nobody will ever invent a strategy with more than 32 strategy or term arguments, right?
I'll keep mulling this one over a bit. Feel free to drop me a line if you see better solutions.
Lexmark E250dn printer drivers
I had the good fortune of buying the Lexmark E250dn laser printer about a month ago. It's a networked printer with a duplexer, all for less than 2000 NOK. Unfortunately, the necessary printer drivers are not part of Foomatic (yet). However, when I browsed the Lexmark support pages, all the printer defintions (PPD) were available as a simple download. Once I added them via the KDE control panel (and the GNOME printer setup tool), all my Linux boxes were able to print flawlessly with it.
Today, I had to install the same printer on a new different machine, so I visited Lexmark again. This time, the PPDs were gone. The only thing I could find was a 25MB .deb download which, once I had fetched it, didn't contain a single useful file. Apparently, it contains a derivative of an old LPD-based printing system.
For convenience, I've posted the tarball with the PPDs. This contains all you need for running this printer with CUPS. Hopefully, a convenient download of these files will reappear on the Lexmark pages, as well as becoming a standard part of future releases of Foomatic.
Completion of my PhD, the Programming Language Independent Abstract Syntax Trees (PLI-AST) project.
Goals
Maintenance of software programs is normally the most expensive part of the software life cycle. Most tools that support maintenance and improvements to programs and program structure, be they compilers, program verifiers, transformation systems, modeling or reverse-engineering tools all represent the program internally either in the form of abstract syntax trees (ASTs), or in forms derived from it. In each of these software tools, the respective AST is almost always specific to a given programming language. While the task of a given tool, e.g., a documentation generator, may be generic across many languages, the chosen program representation binds a given tool to a particular subject language. The goal of this thesis was find more generic solutions to the AST problem. My dissertation investigates how one may construct ASTs more generically, and how one may express reusable, language-independent program analyses and transformations on top of these generic ASTs. It has been an explicit goal that transformations and analyses should be reusable for language families, across language infrastructures and, when possible, across language paradigms.
Results
In pursuit of the above goals, the following results were achieved:
- A Survey of the State of the Art -- The dissertation starts with a survey of existing software transformation systems. The focus of the survey is on transformation languages and architectures. Attention is given to the program models, i.e. the facilities a transformation system has for representing and manipulating programs. The survey indicates that the program model is the central component that needs good abstraction facilities and a good abstract representation if one is to attain transformation reuse and language-independence. It also indicates that facilities for language abstraction are not sufficiently well developed in current transformation systems.
- A Domain Analysis -- Next, the dissertation presents an analysis of program models. It describes the domain objects which must be abstracted over. This analysis suggests that the abstractions necessary for language-independence behave in rather complicated ways: capturing them in traditional transformation libraries is not the best solution. It might be better to express the abstractions as new language features in the transformation language.
- Design of New Abstractions -- The above-noted abstractions are captured and described as abstract data types, using basic algebraic specifications. This formalises the abstractions and the rules governing them. Algebraic specifications are used as requirements for implementing the abstractions in transformation libraries and as language extensions to the transformation language.
- Implementation -- an extensible variant of the Stratego transformation language, called MetaStratego, is presented. The prototypes of all the new abstractions, both transformation libraries and language extensions, have been implemented on top of MetaStratego.
- Case studies -- Four research prototypes were constructed as proofs-of-concept that the suggested approach to language genericity is feasible:
Summary of Results
The primary goal of the research, to provide facilities for language-independent program analysis and transformation, is achieved and substantiated through:
- core API for language independent ASTs;
- generic and mostly automated technique for adapting existing ASTs into the core API;
- an adaptation of the Stratego transformation system that executes on top of the core API; and
- validation of the approach through several substantial case studies.
Most of this research has been presented at international conferences and workshops, and all of it is available in my dissertation, Abstractions for Language-Independent Program Transformations.
Filtering on List-Id in Gmail
One of my biggest gripes about gmail has been its rather infantile filtering capabilities. I've used procmail quite heavily for many years, so functionality-wise, I'm perhaps a bit spoilt.
Recently, however, I discovered that the Has the words field in the filter editor apparently supports a keyword called listid. I've not been able to verify that this actually expands to the various forms of List-Id headers, but at least it worked for all the lists I wanted to filter.
An example might clarify. Say I want to filter the Stratego CVS list, which has the following mail header:
List-Id: CVS notifications for Stratego and XT repositories <stratego-cvs.cs.uu.nl>
I entered the following in Gmail's Has the words field:
listid: stratego-cvs.cs.uu.nl
This seemed to do the trick.
You might wonder why using List-Id would be necessary since most lists use a [list-name] prefix anyway. In many instances, I get a reply that's both to my own address with a Cc to the list. This effectively provides me with two e-mails. I want to have the list-mail placed in the list, and the one address directly to me in my Inbox. Call me neurotic, but I'm a bit particular about this.
Another reason why List-Id is necessary for me, is the Apache harmony-dev list. This list uses many different [xx] prefixes, such as [classlib], [general], [build], depending on which service generated the message. I'd hate to maintain multiple filters for this case.