Comments (6)
I'm not quite understanding. What do you want to compile it to? This project is not a compiler. It is a parser.
from pycparser.
@albertz to a Python script, like cpython_static.py
is.
from pycparser.
I've named my take on this runcprog.py.
Example invocation
./runcprog.py example1.c example2.c -- arg1 arg2
There's no -I or -D or any other option parsing (just arguments) but as a substitute for the idea of -D you could put "#define"s in a .h file and make that your first argument, for example you might make mydefines.h and do
./runcprog.py mydefines.h code1.c code2.c -- programarg1 programarg2
As for -I support, that's going to require some deeper hacking in cparser.py to have support for searching multiple directories. Right now, readLocalInclude and the helper findIncludeFullFilename are just working relative to current working directory. A possible work around for that is to invoke runcprog.py with paths to every relevant .h file as the first set of arguments:
runcprog.py headerneeded1.h /usr/local/include/headerneeded2.h code1.c code2.c -- programarg1 programarg2
Comments before a pull request?
from pycparser.
Ah I see. That looks useful.
About the code: I would avoid the itertools
usage, that makes it quite hard to read, and complicated. You could replace that by much shorter code without itertools
. Also not_a_dashdash
can just be inline where you use it, makes it hard to read as well otherwise.
from pycparser.
I've also created something for this even before I've opened this issue.
It supports -I
and -D
.
But it's a compiler script, not an interpreter.
Since it's based on the cpython_static.py
generation program (with import
), I'm currently unable to integrate it.
from pycparser.
@kaeptmblaubaer1000 Ah, I think I also understand what you have now. This could also be useful.
from pycparser.
Related Issues (11)
- PEP 8
- octal and hex escapes in char and string declarations require further support
- Can't run an example out of the box
- Not able to parse structure variables having the same name as a user defined type using typedef HOT 1
- Syntax Errors reported by pycparser but not gcc HOT 1
- Fedora patch, order of entries in system paths for unit testing HOT 1
- any tutorial will be appreciated HOT 1
- My failed try with py27 on win7 64bits
- More Pythonic repository layout HOT 1
- Python 3 compatibility HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycparser.