Questions tagged [pycparser]

pycparser is a parser for the C language, written in pure Python. It is a module designed to be easily integrated into applications that need to parse C source code

When you provide a code (file) to Pycparser to be parsed, it creates an Abstract Syntax Tree (AST) out of it. Abstract Syntax Tree (AST) is a tree representation of the syntax of source code - a convenient hierarchical data structure that's built from the code and is readily suitable for exploration and manipulation.

For FAQs about pycparser, please visit: https://github.com/eliben/pycparser/wiki/FAQ

78 questions
-1
votes
2 answers

How to split a C program by its function blocks?

I am trying to split a C program by its function blocks. For example, I tried using regex library and try to split by (){. But of no use. Not sure where to begin. string = """ int firt(){ if () { } } customtype second(){ if () { …
NewCoder
  • 39
  • 3
-2
votes
1 answer

Preprocessing of arbitrary C Projects

I want to write a good callgraph program in python and for that reason I use pycparser. Pycparser needs to preprocess c files in order to create an abstract syntax tree correctly. My first approach was to use only the -E option of gcc on the files…
Mr. Moon
  • 9
  • 1
-2
votes
1 answer

how to make the Pycparser to understand my c function

I am using the pycparser for parsing my C code. When I run the script, pycparser could not understand the function and it throws an error like below. File "C:\Python27\lib\site-packages\pycparser\__init__.py", line 93, in parse_file return…
CALICS
  • 5
  • 3
1 2 3 4 5
6