Coder Social home page Coder Social logo

cparser-1's Introduction

Python GNU C99 Declaration Parser

This is a sort-of GNU C99 declaration parser. This parser exists because:

  • I needed to parse glibc headers, Linux kernel headers, and libc as on Max OS X (Darwin / BSD libc?).
  • I did not want to be bound to either of gcc or clang. In retrospect, something like the ROSE compiler might have been best; however, at the time, I did not know about it, and it would make a very large dependency as well.
  • I have a strong preference toward Python, as opposed to another scripting language.
  • Previous Python C parsers that I have tried [1] did not meet my needs when parsing glibc/Linux kernel headers.

This code includes a C tokenizer, parser, and almost certainly buggy declaration printer. The parser assumes that code being parsed is valid--or almost valid--pre-processed GNU C99.

This code exists as part of a much larger project. In that project, this code is used as part of several code generators. The current focus of this other project is type and function declarations, hence the emphasis on those aspects of the language and a complete lack of code to parse normal expressions / statements.

[1] Note: I tried two Python C parsers some time ago, and so recent versions of those parsers might meet my current needs. However, that is now beside the point because this parser meets my current needs rather well.

Maintenance

I will update this library as I discover bugs in it. I also welcome updates from interested third parties.

cparser-1's People

Contributors

pgoodman avatar

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.