GithubHelp home page GithubHelp logo

Comments (8)

refi64 avatar refi64 commented on May 26, 2024

It'd be even easier, since pycparser's own lexer can (largely) be reused.

from pycparser.

eliben avatar eliben commented on May 26, 2024

I'm aware of the preprocessor in the PLY repo - it's been there for a long time! I actually once asked Dave what is its status, and he told me it's just a prototype. I don't believe it changed much since then.

FWIW, I'm not really into developing a preprocessor of my own at this time, since my main aim is Unix-like systems, where this is a non-problem. There are good options out there even for Windows folks - for example Clang for Windows: http://llvm.org/releases/download.html

... perhaps I should add this to the README file.

from pycparser.

paniq avatar paniq commented on May 26, 2024

The Clang executable is 28 MB in size. That's a little much just for a preprocessor, esp. when we're shipping it with a game that is about the same size ;-). I also looked at mcpp as an alternative but it looks like cpp.py could be a compact solution to our issues. I'll experiment and report back.

from pycparser.

paniq avatar paniq commented on May 26, 2024

Yeah. It looks like cpp.py has an issue with including files correctly and resolving macros within the included files. I'm closing the issue since the original topic is covered.

from pycparser.

eliben avatar eliben commented on May 26, 2024

I'm curious about you usage scenario, can you provide more details? Shipping pycparser in a game... that sounds interesting 😄

from pycparser.

paniq avatar paniq commented on May 26, 2024

I'm using pycparser in combination with cffi to parse and generate struct definitions (with metadata) for soil, a transparent serialization library that I developed for our game Nowhere. It's being used for both editing and savegame data, and it will ship on Windows, OSX and Linux.

The engine provides introspection and editing UI for stored C types once it has their type declarations, which is where pycparser comes in. People modding the game have access to engine internals.

from pycparser.

eliben avatar eliben commented on May 26, 2024

Thanks for sharing, that definitely sounds interesting.

FWIW, CFFI uses a regex-based hack to get rid of all preprocessor-y stuff. Often this is sufficient to just parse struct definitions and function declarations.

from pycparser.

paniq avatar paniq commented on May 26, 2024

Actually, it doesn't; it has the same "clean your crap first" policy as pycparser, so I used to use cpp.exe for that; as it's a problem shipping GPL code with our game, and we can't count on cpp.exe being available everywhere, we now resorted to mcpp, which appears to work well everywhere and is BSD licensed.

from pycparser.

Related Issues (20)

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.