AST builder for Objective-C++ language.
Features:
- High-performance lexer
- Some parts of lexer sources are automatically generated by C# tool
- About 5 times faster than NRefactory's C# lexer
- Easy to use parser
- Some parts of parser sources are automatically generated by C# tool
- Able to parse complex constructs like int (volatile*(const *foo())() )()
- Able to parse Objective-C classes
- Easy to use AST tree
- Able to produce source from AST
- Open Source, Free Software
NOTE: Source files must be previously preprocessed
Useful and bugfixing patches are welcomed!
Sources currently resides in NObjective so you should checkout it from:
svn checkout http://objcmapper.googlecode.com/svn/trunk/NObjectiveAST/ NObjectiveAST
Usage
// use lexer to produce lexems // than use parser to produce AST var translationUnit = new Parser( new Lexer( File.ReadAllText( "..\\..\\test.cpp" ) ) ).TranslationUnit;
Example of dumped AST
<TranslationUnit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Body>
<Statement xsi:type="TypedefStatement">
<DeclarationExpression Modifiers="None">
<TypeReference TypeName="char" TypeKind="Normal" Operator="Invalid" Modifiers="None" />
<Declarations>
<DeclarationNode Name="__int8_t">
<TypeReference TypeName="char" TypeKind="Normal" Operator="Invalid" Modifiers="None" />
</DeclarationNode>
</Declarations>
</DeclarationExpression>
</Statement>
<Statement xsi:type="TypedefStatement">
<DeclarationExpression Modifiers="None">
<TypeReference TypeName="unsigned char" TypeKind="Normal" Operator="Invalid" Modifiers="None" />
<Declarations>
<DeclarationNode Name="__uint8_t">
<TypeReference TypeName="unsigned char" TypeKind="Normal" Operator="Invalid" Modifiers="None" />
</DeclarationNode>
</Declarations>
</DeclarationExpression>
</Statement>