Code Monkey home page Code Monkey logo

Comments (6)

albertz avatar albertz commented on May 29, 2024

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.

kb-1000 avatar kb-1000 commented on May 29, 2024

@albertz to a Python script, like cpython_static.py is.

from pycparser.

markjenkins avatar markjenkins commented on May 29, 2024

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.

albertz avatar albertz commented on May 29, 2024

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.

kb-1000 avatar kb-1000 commented on May 29, 2024

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.

albertz avatar albertz commented on May 29, 2024

@kaeptmblaubaer1000 Ah, I think I also understand what you have now. This could also be useful.

from pycparser.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.