Giter Site home page Giter Site logo

sztomi / code-generator Goto Github PK

View Code? Open in Web Editor NEW
124.0 124.0 32.0 140 KB

Contains the full source for my article about implementing a code generator with libclang.

License: MIT License

Shell 0.07% Lua 0.55% Python 97.91% C++ 1.08% Mako 0.39%

code-generator's People

Contributors

psidium avatar sztomi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-generator's Issues

error running generated python code

I had run ./build.sh and here is the output.
Building configurations...
Running action 'gmake'...
Generating Makefile...
Generating codegen.make...
Done.
==== Building codegen (debug) ====
textcomponent.h.bind.cc
Linking codegen

I got a test.py file in src/

When I launch test.py, I am getting below error.
python test.py
Traceback (most recent call last):
File "test.py", line 1, in
import CodegenExample
ImportError: No module named CodegenExample

there is no so file generated or atleast the step is missing.
can you tell what did I missed?

I am very much interested in this automatic python generator and would like to apply this onto a large c++ library. I should also mention there is a heavy use of template in the target library.

extending dump_ast

I wanted to extend dump_ast to print out the names and types of the arguments to functions.

For example, consider the following test.h file:

SomeType foo (AnotherType a, AnotherType b);

Lets suppose SomeType and AnotherType could be defined in another header file.

Currently running dump_ast.h returns the following:

./dump_ast.py test.h 
TRANSLATION_UNIT test.h
  +--TYPEDEF_DECL __int128_t
  +--TYPEDEF_DECL __uint128_t
  +--TYPEDEF_DECL __builtin_va_list
  |  +--TYPE_REF __va_list_tag
  +--FUNCTION_DECL foo

There is no real useful information about foo here, I would like to know that it receives two parameters named a and b of type AnotherType, and that it returns a parameter of SomeType. I would like to think this should be possible using the clang api, unfortunately I haven't been able to do this.

By using the get_arguments() (as opposed to only get_children()) I am able to get the names of the input parameters of a function, but I can't get the names of their types. Suggestions?

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.