Click to See Complete Forum and Search --> : Abstract Syntax Tree Generator Tool


agutal
February 24th, 2009, 05:46 AM
Hello , i need an Open Source AST Generator tool. Can anyone plz specify any tool to which can generate AST .

I found one named GNU - Profiler tool for the same . But i m not able to Understand that.
guyz plz help.

pm_kirkham
February 25th, 2009, 06:07 PM
Most compiler compilers or parser toolkits can be made to output a representation of an AST given the grammar of the language to be parsed. This has very little to do with profiling tools.

Do you have a grammar for the language you're thinking of, or is it a standard language?

Do you have a preference for the language the compiler compiler generates, or the parser uses?

agutal
February 27th, 2009, 07:47 AM
Yes i want that tool for 'C language'.

i want the tool to generate AST for any C code supplied to it.

Plz help.

Thanks in advance.

pm_kirkham
February 27th, 2009, 05:32 PM
There is an option in gcc (-fdump-translation-unit) to dump AST information, but then you have to process that yourself. The Elsa C++ parser (http://www.cs.berkeley.edu/~smcpeak/elkhound/sources/elsa/doc/cc.ast.html) has a direct AST interface in C++, which might be suitable unless you're a C purist. Or any other parser will generate a parse tree you can process to an AST, and many have C grammars already available for them.

agutal
February 28th, 2009, 01:47 AM
Hey thnks for the info. can u plz elaborate on more tools please.

Also what is a GNU - GProfiler.

Also Can i use the Elsa Code in my project and under which license?

Thanks in advance.

pm_kirkham
February 28th, 2009, 05:48 AM
There are many other parser tools - google for the names yacc, bison, antlr, rats, javacc, and I'm sure others. Too many to elaborate on without a specific question, and most of them I haven't used.

I don't know anything about 'GProfiler'. GNU (http://www.gnu.org/)'s profiler is called 'gprof', which reports how much time a program spends in each function, and that information lets you improve the running time of the software by targeting your optimisations better.

The Elsa/Elkhound code is released under the BSD license - see their main page at http://www.cs.berkeley.edu/~smcpeak/elkhound/

agutal
February 28th, 2009, 07:07 AM
Thanks

agutal
March 9th, 2009, 08:55 AM
Please help. Now i want to parse the AST generated by the ELSA Tool.

How to do that ? Please elaborate on that.