Parsec for C or C++

I am working on a research language that is a variant of C. I'd like to use Parsec as the parser. Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point? Thanks, Roy

From a parsing standpoint, C++ is a massive departure from C. Good luck
There is language.c
http://www.sivity.net/projects/language.c/
http://hackage.haskell.org/package/language-c
though.
On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance
I am working on a research language that is a variant of C. I'd like to use Parsec as the parser.
Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point?
Thanks, Roy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge." - Daniel J. Boorstin

I too have a looming spectre of a C++ analysis project, one of the goals of
the project is to be able to efficiently process huge volumes (read GBs) of
code. Given the current benchmarks of language.c compared to the g++ front
end. I was thinking of using an existing C++ parser written in C++, probably
Elsa[1]. Then use haskell to analyze the resulting AST.
[1]
http://74.125.95.132/search?q=cache:7z7wl7oiy70J:www.eecs.berkeley.edu/~smcpeak/elkhound/sources/elsa/+elsa+c%2B%2B&cd=1&hl=en&ct=clnk&gl=us&client=firefox-a
The link seems to be dead at the moment.
On Thu, Jul 16, 2009 at 12:29 PM, Rick R
There is language.c
http://www.sivity.net/projects/language.c/ http://hackage.haskell.org/package/language-c
From a parsing standpoint, C++ is a massive departure from C. Good luck though.
On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance
wrote: I am working on a research language that is a variant of C. I'd like to use Parsec as the parser.
Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point?
Thanks, Roy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge."
- Daniel J. Boorstin
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge." - Daniel J. Boorstin

Thanks Rick. A perfect tip! - Roy
On Thu, Jul 16, 2009 at 12:29 PM, Rick R
There is language.c
http://www.sivity.net/projects/language.c/ http://hackage.haskell.org/package/language-c
From a parsing standpoint, C++ is a massive departure from C. Good luck though.
On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance
wrote: I am working on a research language that is a variant of C. I'd like to use Parsec as the parser.
Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point?
Thanks, Roy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge." - Daniel J. Boorstin
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544

Turns out that Language.C uses alex and happy.
I'm looking to use Parsec.
So back to the original question: Does anyone know of a C or java
parser written using Parsec?
- Roy
On Thu, Jul 16, 2009 at 12:43 PM, Roy Lowrance
Thanks Rick. A perfect tip! - Roy
On Thu, Jul 16, 2009 at 12:29 PM, Rick R
wrote: There is language.c
http://www.sivity.net/projects/language.c/ http://hackage.haskell.org/package/language-c
From a parsing standpoint, C++ is a massive departure from C. Good luck though.
On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance
wrote: I am working on a research language that is a variant of C. I'd like to use Parsec as the parser.
Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point?
Thanks, Roy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge." - Daniel J. Boorstin
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544

A parser for JavaScript (admittedly a much simpler beast) is part of Brown's WebBits: http://hackage.haskell.org/packages/archive/WebBits/0.15/doc/html/ BrownPLT-JavaScript-Parser.html Cheers, Sterl. On Jul 16, 2009, at 1:40 PM, Roy Lowrance wrote:
Turns out that Language.C uses alex and happy.
I'm looking to use Parsec.
So back to the original question: Does anyone know of a C or java parser written using Parsec?
- Roy
On Thu, Jul 16, 2009 at 12:43 PM, Roy Lowrance
wrote: Thanks Rick. A perfect tip! - Roy
On Thu, Jul 16, 2009 at 12:29 PM, Rick R
wrote: There is language.c
http://www.sivity.net/projects/language.c/ http://hackage.haskell.org/package/language-c
From a parsing standpoint, C++ is a massive departure from C. Good luck though.
On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance
wrote: I am working on a research language that is a variant of C. I'd like to use Parsec as the parser.
Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point?
Thanks, Roy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge." - Daniel J. Boorstin
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

There is a C++ parser in C++, it may be of help :
http://42ndart.org/scalpel/
It's a quite advanced WIP.
On Fri, Jul 17, 2009 at 3:58 AM, Sterling Clover
A parser for JavaScript (admittedly a much simpler beast) is part of Brown's WebBits:
http://hackage.haskell.org/packages/archive/WebBits/0.15/doc/html/ BrownPLT-JavaScript-Parser.html
Cheers, Sterl.
On Jul 16, 2009, at 1:40 PM, Roy Lowrance wrote:
Turns out that Language.C uses alex and happy.
I'm looking to use Parsec.
So back to the original question: Does anyone know of a C or java parser written using Parsec?
- Roy
On Thu, Jul 16, 2009 at 12:43 PM, Roy Lowrance
wrote: Thanks Rick. A perfect tip! - Roy
On Thu, Jul 16, 2009 at 12:29 PM, Rick R
wrote: There is language.c
http://www.sivity.net/projects/language.c/ http://hackage.haskell.org/package/language-c
From a parsing standpoint, C++ is a massive departure from C. Good luck though.
On Thu, Jul 16, 2009 at 12:25 PM, Roy Lowrance
wrote: I am working on a research language that is a variant of C. I'd like to use Parsec as the parser.
Is there an existing Parsec parser for C or C++ (or Java) that could serve as a starting point?
Thanks, Roy _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- "The greatest obstacle to discovering the shape of the earth, the continents, and the oceans was not ignorance but the illusion of knowledge." - Daniel J. Boorstin
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544
-- Roy Lowrance home: 212 674 9777 mobile: 347 255 2544 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Alp Mestan http://blog.mestan.fr/ http://alp.developpez.com/
participants (4)
-
Alp Mestan
-
Rick R
-
Roy Lowrance
-
Sterling Clover