All Projects → kornelski → objc2grammar

kornelski / objc2grammar

Licence: other
Objective-C 2.0 grammar for SableCC 3 parser. Allows reading of Objective-C source files into abstract syntax tree.

Programming Languages

java
68154 projects - #9 most used programming language

No Maintenance Intended

To use this you'll need SableCC 3.

java -jar sablecc/lib/sablecc.jar objc2.sablecc3

And of course you'll have to write code that instantiates Parser and does something useful with it.

C source files using typedef cannot be parsed with parser that has lexer and parser nicely separated. As a temporary workaround, I've extended SableCC's parser to recognize some basic Cocoa types — see net/pornel/objc2/hack/PreprocLexer.java.

Grammar skips preprocessor rules. It's a good idea to use existing preprocessor with it, e.g.:

gcc -E test.m
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].