Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Could anyone point me an already available python snippet/script which can parse C/C++ code?
Basically I wanted to create an Class-to-Function() and Object-used-file-location-mapping etc., of a C/C++ source code using python, so that I can create a new level of abstraction of code in a script readable format, which can be used for Artificial Intelligence in the Code parsing..!
LLVM built with Clang will produce libclang for you which, luckily, happens to have great Python bindings right out of the box. Get the latest LLVM and Clang from the releases page, the current stable one being LLVM 6.0.0. Make sure you have the appropriate Python development dependencies and build all of it. Then you can use Clang's Tooling to do all sorts of things to transform or modify your source code, here's a good page to get you started.
I would suggest using Tooling instead of a hand rolled or generated parser especially for C++ due to its complexity. The library however handles it for you and allows you to transform or introspect the produced AST, letting you build on top of that.
No one will generally provide a fully working solution to a complex problem like you've presented, you will have to do the bulk of the work yourself, but those resources are great if you want to get started.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
I would like to ask for your recommendation about coding in Python, mainly with VSC. I have read several Python standards but I have several doubts about testing. I have found some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension.
I have little experience with testing and I have only used unittest, but reading here I believe Pytest is far more complete, should I change to it?
A "basic" test extension is installed with Python Official Extension from VSC, but I don't know if there are better extensions for this. I suppose it is compatible with unittest, pytest and nose. What I don't is how to do test in several Python version with VSC, I believe is a good practice, but I don't know if I must have installed all the other Python versions to do this.
I have find some good extensions in VSC marketplace and (to me) the more relevant are installed with Python Official Extension
Yes this is correct. Most packages needed for basic python programming are included in the official extension. Ofcourse there are some great packages out there that aren't included but still can be quite usefull.
I have little experience with test and I have only use the unittest, but reading here I believe Pytest is far more complete, should I change to it?
Pytest is very easy to use and definatly a recommender, I use it myself and never thaught of changing.
What I don't is how to do test in several Python version with VSC
I recommend tox, their readme even has an example of exactly what you want to do, testing (with pytest) on multiple python versions.
Hope this clears things up.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have few questions about programming a game (3d or 2d) with a python language and Unity game engine
Can we make a game with python in Unity game engine?
if yes how?
please share basic tutorials about this topic.
Unity originally comes with support for scripting in C# and Javascript by default. If you wish to utilize all the features of Unity3d, I would recommend you script in either of these.
That being said, there are third party interpreters and plugins that enable you to use Python on unity, but I would recommend sticking to C#
Refer these for ways to use Python in Unity:
UniPython - Python Scripting in Unity3D based games
Python interpreter in Unity
Currently there is not a way to directly use python within unity. You can use an interpreter that will call functions. This can only take you so far beyond the built in functions that unity currently used.
Since you already know Python and probably learned Java in school or have at least seen it. C# is a very simple language to pick up that is very versatile so I would recommend learning it.
Otherwise you can go Piglet or Arcade Game Engine. These engines are built for Python, Piglet does not need outside libraries / dependencies. You could also go with a Blueprint style coding method, both are available with unity and unreal.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am looking for open source implementations of python compilers written purely in Java, preferably those that support Python 3. I started with jython but it only supports Python 2.7. Thanks!
I don't believe such a thing exists yet. If it does its in pre-alpha and probably isn't stable or well documented. Jython is probably still your best bet, and apparently support for Python 3 is coming to Jython but the timetable is still unclear. See this stack overflow question for more on the subject.
However one advantage of Jython is that you can use any Java classes as if they were Python modules. What features were you planning on using that are only supported by Python 3? Because it is entirely possible (and actually very likely) that you can reproduce those features using Python 2.7, Java or a combo of the two.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I Do Not Intend To Put The Project On The App Store
Short Question - is there any up-to-date PyObjC tutorial for embedding python scripts into an iOS app written in Objective-C and/or swift? If not if there any up-to-date method for achieving the same goal?
Background: I want to run a bunch python scripts in an objective-c ios app. I have tried a couple of things:
I have tried using the python.framework, but i get a "could not build Python module" error. After googling for help, I realized that python.framework does not work on iOS - Run python scripts in iOS app
PyObjC - For the sake of experimenting, I managed to get the generated *.plugin working on OS X. I followed this tutorial - https://pythonhosted.org/pyobjc/tutorials/embedded.html
Using the same method on iOS, it fails to compile
If anyone is ever interested in calling python from swift, here is some helpful material I found(used) -
use the python framework - https://developer.apple.com/library/ios/technotes/tn2328/_index.html
PyObjC (a little more challenging) -
cobbal - https://github.com/cobbal/python-for-iphone
python docs (you would need to make C-Swift bridhe)
Most of it is for Objective-c, but if you need to use swift you can easily just create an ObjC-Swift bridge (super-super easy) - Lookup the apple docs
I managed to get the first two methods working on an OS X app, but I got some architecture errors for iOS(not important). I've pushed the project aside for now, I have a ton I need to get done.
Hope this will be helpful for anyone interested :-)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I write most of my codes as Fortran extension to Python, using fantastic f2py tool.
However, it is sometimes difficult to catch the memory leaks, and profile the program (where the most time it is spent).
The question is:
Is there some simple way to debug and/or profile extensions (especially, f2py-generated) for Python?
Using valgrind seems to be complicated (I use MacOsX, and do not want to recompile the interpreter).
The only options that I have now is print - debugging + print - profile, which is time-consuming.
In case any others have the same problem but on Linux platforms (sorry, OS/X is not supported so I know this is not "the Answer" for you) - the Allinea tools can profile and debug the Fortran extensions called in Python, and see any memory leaks.
Compared to callgrind/kcachegrind, the profiler runs much faster (having max 5% slowdown typically) and it's much deeper as to why the code runs slow as it understands vectorization and running in real time means I/O profiling is accurate.
There's a blog exploring f2py extension debugging and profiling that introduces it.