Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » IMP » Generating AST for C parser using IMP (AST generation)
Generating AST for C parser using IMP [message #654361] Tue, 15 February 2011 11:58 Go to next message
uff  is currently offline uff
Messages: 3
Registered: February 2011
Junior Member
I have written a C parser using JavaCC and now want to generate AST for the parser using IMP IDE. Would there be any problem with JavaCC generated parser or the IMP manages most of hand-written parsers?

Usman Bashir
Re: Generating AST for C parser using IMP [message #654493 is a reply to message #654361] Wed, 16 February 2011 03:07 Go to previous messageGo to next message
uff  is currently offline uff
Messages: 3
Registered: February 2011
Junior Member
Adding one more question:
How does the LPG parser incorporate C header files while parsing the C source file?
Re: Generating AST for C parser using IMP [message #654630 is a reply to message #654361] Wed, 16 February 2011 14:15 Go to previous messageGo to next message
Robert M. Fuhrer is currently offline Robert M. Fuhrer
Messages: 294
Registered: July 2009
Senior Member
uff wrote:
> I have written a C parser using JavaCC and now want to generate AST for
> the parser using IMP IDE. Would there be any problem with JavaCC
> generated parser or the IMP manages most of hand-written parsers?

IMP has no problems with JavaCC, ANTLR, or hand-written parsers.

Likewise, IMP can work with any kind of AST, but it sounds as though
you're considering using LPG for the ASTs? I'm not sure why that is,
but it might be easier to use the JavaCC-generated ASTs instead. If
on the other hand you do decide to use LPG-generated ASTs, the only
downside is having a parallel version of the grammar that LPG can
consume, just to get the ASTs. IMP itself doesn't care that one
framework generated the parser and another the AST hierarchy.

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10-lang.org)
Re: Generating AST for C parser using IMP [message #654631 is a reply to message #654493] Wed, 16 February 2011 14:16 Go to previous messageGo to next message
Robert M. Fuhrer is currently offline Robert M. Fuhrer
Messages: 294
Registered: July 2009
Senior Member
uff wrote:
> Adding one more question:
> How does the LPG parser incorporate C header files while parsing the C
> source file?

LPG has no specific support for doing preprocessing. At this moment, neither
does IMP, so people who need preprocessing roll their own by incorporating
the preprocessing inside their IParseController implementations, before
calling the "real" parser.

Hope that helps!

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10-lang.org)
Re: Generating AST for C parser using IMP [message #654653 is a reply to message #654630] Wed, 16 February 2011 15:17 Go to previous messageGo to next message
uff  is currently offline uff
Messages: 3
Registered: February 2011
Junior Member
Likewise, IMP can work with any kind of AST, but it sounds as though
you're considering using LPG for the ASTs? I'm not sure why that is,
but it might be easier to use the JavaCC-generated ASTs instead. If
on the other hand you do decide to use LPG-generated ASTs, the only
downside is having a parallel version of the grammar that LPG can
consume, just to get the ASTs. IMP itself doesn't care that one
framework generated the parser and another the AST >hierarchy.


I didn't find any open source for AST creation using JavaCC for C Parser, so was looking for some hand-made option in form of IMP.
If you could give any pointers to open source AST, it would be helpful.

Preprocessing is a bit nasty job, I hope I am able to make it work using IParseController.
Re: Generating AST for C parser using IMP [message #659143 is a reply to message #654653] Fri, 11 March 2011 09:29 Go to previous message
Andy  is currently offline Andy
Messages: 6
Registered: March 2011
Junior Member
Hi uff,
i've i question for you.
I have wrote a JavaCC parser for my language but i don't know how i could integrate this in my IMP project so i wanted to ask you how you did it...

Thanks in advance.
Andy
Previous Topic:Proposed changes to indexing and PDB API
Next Topic:Proposed change to IParseController API
Goto Forum:
  


Current Time: Thu Oct 30 23:47:16 GMT 2014

Powered by FUDForum. Page generated in 0.01842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software