0

Possible Duplicate:
Is there a good Python library that can parse C++?

I want Python to scan through a file (a .cpp file) and generate tokens from it using the in-built Python tokeniser.How can this be achieved?

Community
  • 1
  • 1
neon
  • 31
  • 1
  • 4
  • 1
    Actually parser will yield tokens, so this might help you out. [http://stackoverflow.com/questions/1444961/is-there-a-good-python-library-that-can-parse-c](http://stackoverflow.com/questions/1444961/is-there-a-good-python-library-that-can-parse-c) – Kracekumar Jul 27 '11 at 10:53
  • @kracekumar: A parser eats tokens and generates a syntax tree. Creating the tokens is the job of a tokenizer (or "lexical analyzer"). – Paŭlo Ebermann Jul 27 '11 at 17:47

1 Answers1

0

The built-in tokenizer and ast stuff is for parsing Python, not other languages like C++.

You may want to look at GCC-XML.

Mike DeSimone
  • 41,631
  • 10
  • 72
  • 96