Jasper: The Saga Continues. 8

Posted by Uncle Bob Sun, 04 Feb 2007 17:04:19 GMT

It’s Sunday. Justin came in second in his wrestling tournament. And I downloaded the source code for Tomcat to figure out how the Jasper compiler works. sigh

I have an hour or so before Ann Marie and I drive to Angela’s house to visit our three granddaughters, then pick up some things at Sam’s club, and then I fly to Pennsylvania to kick off an Agile transition for a new customer.

Last night, after the tournament, I started studying how Jasper works. At the high level, Jasper is a fairly standard compiler that parses it’s input and creates an intermediate representation of nodes. It generates java output by walking those nodes with code-generating visitors.

At the low level Jasper was written by slinging a lot of brute force code around. There are long if/else chains, and funky variables like t1, t2, t3, and t4. For some reason the authors felt they should do their own parsing rather than using antlr or javacc; but that’s fine with me. JSP is a pretty simple syntax after all.

What I’ve learned so far is that there are quite a few ways for the compiler to ignore the taglib directive. I don’t understand yet what all those reasons are, I can just see the if statements that silently bypass that processing. Some are based on a variable named isDirective. This variable is passed down a long chain of calls from the upper levels of the compiler, down to the lower reaches of the generators. I still haven’t figured out why it gets set, but I think it might have something to do with a special compiler pass or something.

Anyway, I won’t bore you with the details right now. I’ll just see if I can learn anything more about how this thing works.

But I will say that it’s a shame that I have to dig through compiler code to figure out why Jasper generates code differently in the tomcat environment and the command-line environment.
Two hours later… While digging through the compiler code, I noticed that there are lots of nice debug logging messages. If I could turn on debug logging, I could get a sense about what’s happening inside the compiler.

So now all I have to do is turn on debug logging. That ought to be easy, right?...

Trackbacks

Use the following link to trackback from your own site:
http://blog.objectmentor.com/articles/trackback/132

Comments

Leave a response

  1. Avatar
    Criminal Check over 4 years later:

    Thanks for this informative post. Keep posting good and useful information.

  2. Avatar
    Criminal Records over 4 years later:

    This variable is passed down a long chain of calls from the upper levels of the compiler, down to the lower reaches of the generators. I still haven’t figured out why it gets set, but I think it might have something to do with a special compiler pass or something.

  3. Avatar
    Tenant Screening over 4 years later:

    What I’ve learned so far is that there are quite a few ways for the compiler to ignore the taglib directive. I don’t understand yet what all those reasons are, I can just see the if statements that silently bypass that processing. Some are based on a variable named isDirective.

  4. Avatar
    SEO Firm India over 4 years later:

    got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.

  5. Avatar
    Earnest Guest over 4 years later:

    I like the structure of the posts. I bet you are able to even do better. Write a lengthy article and show us what you are able to do. I have no doubt you’ll create even better information. I have subscribed to a lot of blogs but this one is really a keeper!

  6. Avatar
    okey oyunu oyna over 4 years later:

    thanks for this post i have been read for an hour…

    Dünyan?n en büyük online okey oyunu bu sitede sizleri bekliyor. Gerçek ki?ilerle sohbet ederek Okey Oyunu Oyna ve internette online oyun oynaman?n zevkini ç?kar

  7. Avatar
    coach bags uk over 5 years later:

    Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something.

  8. Avatar
    brother ink over 5 years later:

    Brother ink cartridges for the best quality printing from Brother printers.

Comments