[antlr-interest] Re: How much abstraction would you recommend? (funny misspelling corrected :)

Andreas Rueckert a_rueckert at gmx.net
Sat Dec 22 02:27:56 PST 2001


On Fre, 21 Dez 2001 jsrs701 wrote:

> Howdy, Andreas,
> I hope I'm not completely misunderstanding the point of your project, 
> but I'd say you should DEFINITELY hide the classfile details from the 
> user.  The .class file format is obnoxious.  You can't even execute 
> it in place without doing a lot of preprocessing!  Ugh!

The problem with this is, that you get a classfile parser, that does some
complex preprocessing and is therefore not very well suited as a example for
binary parsing. That was one of the things, I wanted to use it for.
On the other hand, the example won't make any sense to you, if you don't have a
clue about the classfile format, anyway.

That's a example of the current code:
// Info on the main class
{ short class_info_index = 0; }         // A index of a entry in the constant pool.
        : class_info_index=u2
            ShortAST class_info = (ShortAST)getConstant((int)class_info_index & 0xffff);
            String class_name = getConstant(class_info.getShortValue());
            #class_info = #[CLASS_NAME, class_name];
getConstant(int index) gets a entry from the constant pool. The class_info in
the classfile holds a index to a class_info structure in the constant pool. The
class_info structure holds a index to a UTF8 String constant in the pool. I
dereference both and create a AST node, that holds the class_name directly. Is
this easy enough to understand? Maybe add more comments to explain the details?

> If your project isn't too proprietary, can you publish your class 
> file parser?  Ter's been wanting one to throw around for years.

I know. One of the reasons why I wanted to do this. He helped the ArgoUML
project a lot with his work, so I thought we should give something back. I want
to assign the copyright for the 2 parser to Ter, so he could include it in the
Antlr release. Some other code, that should be used in a ArgoUML reverse
engineering framework have to be under BSD, so they can be included in the Argo
release. I'm thinking about a dual license for the rest. GPL-like for non
commercial use, but a different license for commercial use, so some money could
be made that could go to a ArgoUML foundation to promote the use of Argo.

> Good luck,

Thanks! But things look good, that something will come out of this. I'm too far
to drop the project now. Jars are already parsed and some stuff shows up in
Argo, even if it's not complete yet.



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list