DLTKCore and the AST of expressions and statements [message #1113191] |
Fri, 20 September 2013 19:42 |
Alexandre Torres Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Hi,
Looking for ANTLR implementations for Ruby and Python I found that DLTK uses ANTLR grammars to parse Python and Ruby. The grammars are quite complete (with statements such as IF, WHILE, expressions...). But when using the DLTKCore.create(...), the AST exposed by the tool does not decomposes the implementation, it seems that it ignores most of what the grammar can recognize.
What I need is to, sometimes, read the expressions and code blocks inside each method or field initialization. How could I do that using DLTK ?
Do I need to have the file open in the editor to get the AST?
I´m new to DLTK and pretty lost to what can I do. In fact I´m more into code generation and reverse engineering than user interfacing or building editors, perhaps DLTK is not what I need.
Thanks
What I see the Pyhton grammar, but can´t see in the AST:
compound_stmt returns [ Statement statement = null ]:
statement0 = if_stmt { statement = statement0; }
| statement1 = while_stmt{ statement = statement1; }
| statement2 = for_stmt{ statement = statement2; }
| statement3 = try_stmt{ statement = statement3; }
| statement4 = funcdef{ statement = statement4; }
| statement5 = classdef{ statement = statement5; }
| statement6 = with_stmt {statement = statement6; }
;
// If Statement
if_stmt returns [ IfStatement statement = null ]:
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03168 seconds