April 19, 2007, 3:10 p.m.

Abstractions All Around

I just finished up a bunch of work with a domain-specific search language. We have various types of objects that come from various places and want a consistent way to locate them.

My language is written in a language (jjtree) that compiles to another language (javacc) that compiles to another language (java) that compiles to a machine independent representation (.class) which just-in-time compiles to machine code.

One of the target data sources for this language was hibernate. Hibernate is targetted by taking my AST and writing out an HQL query. Hibernate then parses that query into an AST, and then converts that AST into another AST, and then takes that second AST and writes out SQL. That SQL is then sent to a database where it is, again, parsed into an AST and then further magic happens.

Every piece does its job pretty well, but if you pay attention, a lot of stuff goes on just to ask a simple question.

blog comments powered by Disqus