C– for cross compiler

In late 1994, when I need to write a programming language it was a pain. You must start with flex, lex and so on, and the way will be very long.

Then I found GCC was able to compile in a pseudo-machine language, already optimized. Then a set of backend was able to emit mc68000, 80×86, power pc code…

I am glad to see now there is a “stripped down” version of the C language to simplify this hard work….
By the way, Fortran has been the first compiled language, appeared near 1957.

“A new perspective on programming-language infrastructure”

Welcome to C–

Suppose you are writing a compiler; how will you get quality machine code? You might write your own code generator—but that’s a lot of work. You might use somebody else’s: perhaps VPO, MLRISC, or the gcc back end. But each of these impressive systems has a rich, complex, and ill-documented interface, and furthermore, to use MLRISC you must write your front end in ML, to use gcc you must write it in C, and so on. You might generate C, if you can live without multiple results in registers, proper tail calls, computed gotos, accurate garbage collection, and efficient exceptions.

You would be much happier with one portable assembly language that could be generated by a front end and implemented by any of several code generators. Such a language should serve as the interface between high-level compilers and retargetable, optimizing code generators. Authors of front ends and authors of code generators could cooperate easily. C– is that language.

What distinguishes C–

The following aspects of C– distinguish it from other compiler infrastructures:

* Other infrastructures focus on adding new optimizations; C– focuses on supporting multiple front ends for multiple languages.

* C– has a machine-level type system, so you don’t have to shoehorn your favorite high-level language into a high-level data model that doesn’t fit.

* C– provides a run-time interface, so you can implement garbage collection and exception handling using the techniques that are best suited to your language.

The run-time interface is the most novel and most distinguishing feature of C–.

via C– Home.

Java HttpClient and Load Balancer bad interactions

Working for a very big customer, I found a very nasty interaction between Sun HttpClient (JDK 1.4) and Http  Load Balancers.

In a complex network environment, sometimes you can experience low level TCP/IP comunication errors, because sometimes HttpClient get confused and hangs.

The bad behavior of Sun HttpClient is well known: some guys suggested me to use the Axis Web Client. Anyway you can solve the issue adding these three parameters to the JVM launch line


The first two parameters set globally the socket timeout to 5 seconds.
The last parameter forces the JVM to avoid reusing http connections when doing http request.

To be honest, http.keepAlive=false is not always effective and could have huge performance impacts, so be very carful adopting it.

But if you stick on the two sun.net.client.default*  properties (doing some tests) you can solve the issue.


From Java Plug-in Control Panel:

Networking properties description:



These properties specify, respectively, the default connect and read timeout values for the protocol handlers used by java.net.URLConnection. The default values set by the protocol handlers is -1, which means there is no timeout set.

sun.net.client.defaultConnectTimeout specifies the timeout (in milliseconds) to establish the connection to the host. For example, for http connections it is the timeout when establishing the connection to the http server. For ftp connections it is the timeout when establishing the connection to ftp servers.

sun.net.client.defaultReadTimeout specifies the timeout (in milliseconds) when reading from an input stream when a connection is established to a resource.

For the official description of these properties, see Networking Properties.


Portal Software: LifeRay

I am not a big fan of portal software, because it is not cheap to delivery.

Portal specification is heavy to use and implement, and can have a reason only in very big corporate company.

SingleSignOn can be delivered in different and simpler way.

The big advanteg of the Portal is the ability to “deactivate” specific unstable feature on the fly, with also the ability to aggregate remote data (remote portlet is one of the key of the idea behind portal specification).

If you need to setup a fast demo, LifeRay is ready to use.

Dynamic languages troubles

I have read http://www.manageability.org/blog/stuff/chandler-failure and I think it is very danger way of exposing concepts.

In the article pointed out, the quite dead Chandler project is compared to the multi-billion Eclipse project. And then a too easy analysis is done against dynamic languages, where Java is the absolute winner.

I will try to fix some of the things said there, and to add also my two cents here :)


First of all, I use Java a lot, but I am also a fan of dynamic languages. Every tool has its place in the world, and I will avoid some holy war here. 

Anyway, it is important to understand major differences between very distant projects.


First of all, Eclipse is a very huge project, developed by IBM and based from the beginning with a very strong hype on plugin modularization.

The effort pushed inside Eclipse is very huge and come also from the San Francisco Project. Other IDEs (like JBuilder and Together) stops fighting Eclipse years ago, and eventually failed even to sell their stuff.

 So there are no similar example to Eclipse in Python/Ruby/Perl world. Even in PHP is hard to find a so huge and well designed program. And the languge here is less important: a company big as IBM can also code in PL/I all its stuff, without so much pain :)

Second, PHP is very successful language, even if a bit too insecure, at the present time.

PHP Language has poor support for modules and so on, but project like Drupal, Joomla and other are full of plugins, quite easy to write.

RubyOnRails is falling down because nobody is understanding why PHP should be abandoned for Rails.

Java architectural model is very well written and Sun worked very hard to it. Java Hot Spot VM is derivered from the Self dynamic language,  and has inside technology difficult to develop in an open source project.

Surely Dynamic languages are strong when there is the one-man-band paradigm: sharing works in Smalltalk was  a bit complex in early days.

Put Perl, python and ruby have a strong modularization concepts, and so this issue is often solved.

I have tried Zope and I think it is weak because:

  • Zope is user is non-existent. Zope user is a super-skilled web master which wants a web CMS without writing so much code.
  • Zope product upgrade is a nightmare
  • A stuck Zope Product can destroy your work. So hosting Zope is a problem
  • A lot of Zope basic objects (like cache accelerators and so on) are poorly minded: they works only on RAM, and are not thinked well. Drupal 5 has more strong theory for this issue, and Drupal is poor PHP code.
  • Zope use a proprietary database, when a simple SQL database with a relational mapper can do the same thing…think twice before reinventing the wheel!
  • Every major Zope releases breaks a lot of the API. This is the most stupid thing you can do as open source developer.

Chandler failed because they tried a very difficult business: calendar software is a very difficult area to address. All operating system (including possibly C/64 :-) has now a huge set of Personal Information Manager software (PIM), and LDAP solves sharing issue for big companies

Even Ximian Evolution is near death.

And your bigger competitor is Microsoft Exchange and… yes… old Unix.

Dynamic lanuages has many lacks, and difficult refactoring is a problem but… remember frefactoring tools was INVENTED under SMALLTALK!

IT is a place where you must be careful… isn't it?





pyparsing review

This is the sad true: parsing is boring. And writing parser is even worst.

If you can choose a scripting language for parsing you can think to do it in perl.

For this way, take a big breath and go in the black sea  of perl's funny regexp. They are funny only if you have that special love for the regular expressions.

But if you are more confortable with python, pyparser is a better solution.

Pyparser is a library written in Python, for building parser described with a BNF (Backus-Naur Form).

O'Reilly has just published a "Short Cuts" e-book written by Paul McGuire; in less then 70 pages you get a very good insight of pyparser.

Even if you are new to python, the book is very easy to read.

And if you do not know nothing about parser and Backus & Naur, you will find an easy path to understand it. Parsing is a tricky topic because of the grammar theory behind it, but for all-day work, you can follow the McGuire introduction.

After some simple example, you'll dive into a small web page parser.

It is very amazing how you can do extraction from web pages without a complex Sax parser, and using only  a very compact grammar.

After this intro examples,  the manual take us to a more complex task: a lisp-like expression language parser called S-Expression.

This example is important because complex data structure are oftern recursive as S-Expression are.

The last chapter, "Search Engine in 100 Lines of Code", is a well-written example, and show us how to build a small search-engine-grammar.

 So this e-book is a "must" if you need to do even simple parsing and you… do not want to become crazy with too regular expressions :)