Search code examples
javacorbaidl

how to implement an idl-to-java compiler


I need to implement an idl-to-java compiler. In fact, it's not idl-to-java. Interface definition language is extended. So I need to implement a compiler which can generates java source file. I know nothing about corba and I feel hard to start. Do you think it's possible for me to finish this work in half a year? and if so, what should I do. ps: please forgive my English.


Solution

  • If you don't know anything about parsers and parser generators it's going to be a tough job, but I think that half a year should be plenty if you don't start from scratch.

    I suggest that you use Antlr, which happens to have an IDL parser implementation among its contributed examples. This is probably for an older version of Antlr, but it's definitely a good starting point. Be sure to get hold of the Antlr book, you're going to need it!

    For the code generation part you could use StringTemplate, a template engine written by Antlr's author, Terence Parr, exactly for this purpose.

    If you really have to implement a whole ORB you might as well check out how others did it, e.g. here.