Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Bernhard (4508)

https://www.xing ... hard_Schmalhofer

A freelance software engineer with experience in webapplications, databases and bioinformatics.

A contributor to Parrot and the person behind Pipp.

A physicist who worked with third sound in Helium-III and CCD X-ray detectors.

barney on
github: []
LinkedIn: []
XING: []

Journal of Bernhard (4508)

Tuesday January 31, 2006
02:31 PM

Quine, wisdom teeth pulled

This month I didn't get much done on the ANTLR3 front. Instead I did some directory renaming in the Parrot tree, did a quine in PIR and brought the long awaited HQ9+ to Parrot.

Doing a quine in PIR was fun. The first attempt ended up quite cheatingly with a dynamic op 'q' in myops.ops. Then, thanks to google, I found the standard recipe for quines and did 'quine_ord.pir'. The '_ord' comes from that I use the 'ord' opcode to encode part of the quine code in a data section.

This weekend I finally built up nerves for ANTLR3. There is now support for testing an ANTLR3 implementation in the 'Parrot bc' test suite. And I started on a dummy grammar for 'bc' with Java as a backend.

This afternoon I also had two of my wisdom teeth pulled. It went better than expected, and I feel almost up to par right now.

Thursday December 29, 2005
02:27 PM

First skiing holidays, then hacking on ANTLR v3

For tomorrow I'm planning a quiet day at $work and on Saturday me and Regina are heading for a week a skiing in the Wildschönau, in the Austrian Alps. I'm looking forward to that, as there has been ample snowfall in the Mountains. I won't take my notebook, only my copy of 'Language Programming Pragmatics' for light reading.

After the holiday I really plan to get going on a Parrot backend of ANTLR v3. I'm not sure about the target language yet. I might start with PIR and then try to learn more about the 'PIL2 minilanguage'.

WRT to 'Parrot bc' I'll continue to piggyback on 'punie'. So I try to generate 'Allison's PAST' from bc, for whatever features are implemented for punie.

At $work I have been looking at This looks like exactly like the thing I want for web testing. It might also make the colleagues in quallity assurance happy! The only thing I'm really missing is support for frames. But some smart Ruby guys are already working on it.

Wednesday November 30, 2005
05:18 PM

Prototype for less work and more fun

At $WORK I'm still doling away at my Mason-powered webapp, that keeps track of interesting biological sequences.

Lately I have been AJAXifying things with the help of Prototype, This works out quite nicely. For the user it makes the interaction more fluent. For the programming part, I experienced that it makes the seperation of content and actions more natural. I have to admit though, that I have no proper MVC setup yet.

For effects I use I'm quite fond of the autocompleter. I use it to let the user choose for the NCBI taxonomy database

The next think to look for is a consistent set of widgets, preferably based on Prototype. Perhaps Rico,

Friday August 12, 2005
05:06 AM

Off to vacations in Istria

This afternoon I'm heading with Regina down South to Istria. We are staying in an appartment in lovely Rovinj,,13.642187&spn=0.025854,0.059524&t=h&hl= en.

Tonight we propably stay overnight in the Austrian Alps. If we are lucky, we will glimps some meteorites from Perseids meteorite shower.

I don't know if I have Internet access in Rovinj. My notebook is packed. I've also downloaded the 'bc' and 'm4' specs and might work a little on their respective Parrot ports.

Friday July 29, 2005
02:38 PM

No unary '+' in 'POSIX bc'

I'm still trying to learn about computer languages, by targeting 'POSIX bc' to Parrot. Currently I'm checking whether I got the precedences of '+', '-', '*', '/' and '%' right. The harder things are still to come: variables and subroutines.

There is a funny thing I noticed about POSIX bc. POSIX bc has no unary '+', thus '+1' on a line by itself is a syntax error.

bernhard@ubuntu:~$ bc -s
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
(standard_in) 3: syntax error

Tuesday July 12, 2005
03:13 PM

Meeting of the Munich Perl Mongers

Yesterday, the Munich Perl Mongers were guests of the Munich chapter of the System Administrators Guild Europe. This invitation was much to the relief of Harald Jörg. He got a break from the tedious task of determining the number of attendees, needed for restaurant reservations. An amazing number of about 20 SAGEs and 10 Mongers turned up.

The topic was 'GUI in Perl', and we even had presentations. Steffen Ulrich talked about his experiences with an homegrown competitor of SAP, written in Perl/Tk. He also did comparisons with other GUI toolkits. Tk seems to have the best impedance match with Perl, but is also the worst looking GUI toolkit.

Harald showed us a Perl/Tk project he had resurected after 8 years of banishment. He did a 3D-Designer for houses and furniture. It was jolly fun flying thru walls, all without VRML. No Doom monsters were to be seen anywhere.

Stephen Riem tooks us on tour of the darker sides of Programming, by showing a Java application for the planning of television commercials. The number of lines of code was truly frightening.

Saturday July 09, 2005
09:00 AM

Cool things at $work

My main project at $work is a Mason-based webapplication for keeping track of interesting biological sequences. As a new round of develoment is just starting, I finally took some time to do some refactoring and to beef up my test suite.

Almost all the application logic, interface to the database and connection to the world is wrapped in a set of Perl5 modules. Running the existing test suite with Devel::Cover was dead easy. It immediately showed me missing tests. Even better, it pointed me to some obsolete code. This is very good, as deleted code is guaranteed to be bugfree code.

The next toy was Test::TAP::HTMLMatrix. I think that there is no support from Module::Build yet, but I could avoid coding by fetching a script from There is still some red in the generated HTML, but I blame it on the world, that keeps on changing.

In the left frame of the webapplication there is a project tree, that can contain several hundred nodes. This used to be a homegrown tree, but I replaced it with a COOLjsTree, The COOLjsTree has a fairly complete API and certainly looks more professional than my old tree. My old tree only excelled in the speed of opening and closing subtrees, as it was simply a nested unordered list with some CSS and JavaScript.

I also switched to returning instances of Return::Value from some methods. It is nice to have a standardized returnvalue. However I feel somewhat uneasy about the overloaded get_bool() and get_string().

What are the next cool things? Catalyst with HTML::Mason views sound good for the next project. For web testing I'd like to use HTTP::Recorder and WWW::Mechanize, but I think that I can't do without JavaScript support.

Monday May 02, 2005
05:50 PM

Munich Perl Mongers meeting

Last Thursday we had our semi regular meeting of the Munich Perl Mongers. Eight brave souls tourned up at the Hirschgarten, Unexpectedly we had sunshine and thus could sit outside in the quite beautiful beergarden.

Topics ranged from mod_survey to Perl scripts for verifying orders in a large print shop.

Ralph Leonhard was interested in R on Parrot, but lacks time and funds. He mentioned that R is based on an internal scheme engine. So I started to look at languages/scheme in the Parrot SVN.

Wednesday April 06, 2005
02:23 PM

First steps with ANTLR and Python

I'm still trying to find the ultimate tool for implementing languages on Parrot. Never having to take a compiler construction class, and not really needing it at work, I'm not familiar with any of common parsing tools.

For now I'm getting down with ANTLR, trying to bring 'bc' to Parrot. 'bc' is actually a neat little language, I like it much better than 'm4'. The main purpose of 'bc' is of course the evaluation of arithmetic expressions. But there are also variables and subroutines. So 'bc' might be nice sandbox for playing with the PAST interface of Parrot.

ANTLR looks very good to me. Like with lex/yacc a syntax definition is transformed into code for lexers and parsers. The pros are

  • Mature, with lots of documentation and examples
  • Lexers and parsers in a variety of languages

The cons are:

  • No Perl5 backend
  • No Perl6 backend

The nice thing is that Abstract Syntax Trees are easily constructed. With a little syntactic sugar, on can specify which tokens are to be ignored and which tokens introduce subtrees. The generated AST can be processed with TreeParsers.

With ANTLR 2.7.5 Python code generation has been added. So I decided to do some baby talk in Python. The Python syntax is very regular and easy to learn, but I miss the human touch from Perl and Ruby. The whole indentation business makes me feel rather confined. I like hitting '%' in vim!

So ANTLR is thumbs up, and Python is thumbs down.

Saturday March 19, 2005
10:19 AM

*BooleanArray PMC for Parrot

My Easter project is to look into the FixedBooleanArray and ResizableBooleanArray PMC. As the name implies, a *BooleanArray is an array of boolean values. This functionality could be achieved with a *PMCArray of Boolean PMCs. However this wastes a lot of memory, as a bool really just needs a single bit.

Currently there is a minimal implemention from Matt Fowles. The downside of the current implementation is that a bool is stored in an INTVAL. This means that 31, or 63, bits are wasted per bool.

Making the current implementation to use 1 bit per bool should be straightforword. But as laziness if one of my virtues, it would be nice if somebody has already done the work. My first idea was to steal the code from Perl5's Bit::Vector. This module looks very nice and very complete, with a lot of tests. Bit::Vector is XS-based and the C-code can also be used without Perl. The downside is that the C-library is under GPL, which makes it hard to incorporate in Parrot.

The docs of Bit::Vector mentions that the module is also a big integer math library. Well, a bit vector is really the same as a big integer. Thus it would be economical, if the BigInt PMC and the *BooleanArray PMC have the same implementation in Parrot

The BigInt PMC is implemented by calling out to GMP, the GNU Multiple Precision Arithmetic Library. When there is no GMP, than a fallback implementation jumps in. Of course, all the methods needed for *BooleanArray are already implemented in GMP.

So that's the plan:

  1. Steal the test suit from Bit::Vector
  2. Let *BooleanArray PMC call out to GMP
  3. Make the fallback implementation use 1 bit per bool
  4. Factor out common code of BigInt and *BooleanArray