What languages can be debugged under gdb and how [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I've read here that gdb can be used to debug languages like Python or Ruby. How is it possible? Which another languages can gdb debug? How to debug those languages under gdb?

gdb can primarily debug compiled languages. It has built-in support for several (from memory, C, C++, Ada, Fortran, Pascal, Modula-2, and Go), but you can also use the C language support with any language and at least get something done.
It has a bit of support for JIT-compiled languages, but you have to write some of your own support, and it doesn't provide a way to hook into the expression parser.
It doesn't have any direct support for interpreted languages. You can write pretty-printers and frame filters to display some information more nicely. The blog you linked to was about using knowledge of the implementation of a language to help with debugging scripts written in that language -- this is definitely possible, but it's not easy.
It's been a long-standing wish-list item to extend the gdb Python interface to allow better multi-language debugging. However, as far as I know, nobody is actively working on this.

Related

Library routines and coroutines [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I am reading the book "Advanced Programming in the UNIX Environment"
This library is important because all contemporary UNIX systems, such as the ones described in this book, provide the library routines that are specified in the C standard.
I am very confused here about the word routine Coroutine - Wikipedia
Does it has any relations to coroutines?
No.
A "routine" is a series of instructions. Similar to a "function" or "program". The word "routine" is somewhat archaic (but "coroutine" is not).
Library routines means library functions. It has nothing to do with coroutines.
From my understand, coroutine is a specific efficient manipulation way when we handle a routine. the other ways include: multi-process and multi-thread as you may be familiar with.

Can Python with turtle and tkinter replace NetLogo? Which is worth more the time? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I never went too far into NetLogo, and being a novice in Python I started looking into the turtle module, aiming towards ABM. I have seen some simple implementations of the turtle module (turtledemo and YouTube) but none were comparable to NetLogo library's examples. I went over (once) the mesa tutorials and it seemed interesting but, as it says, more advanced stuff require Javascript. I've also read that NetLogo is fast to pick up.
Considering the above, and adding your own experience, could NetLogo be a better choice than Python? Could you estimate how hard each path would be? Do you have any other suggestions?
I teach ABM. I used to use Python for my course,
using a module that provides some NetLogo-like functionality:
https://raw.githubusercontent.com/alan-isaac/econpy/master/abm/gridworld/gridworld.py
I gave that up. Although Python is a great language for
teaching programming, NetLogo is a much better language for
teaching ABM. (Both started out as teaching languages,
very roughly speaking, and became much more.) It is very
easy to get started with NetLogo. It's builtin facilities
also support very sophisticated model building. These facilities
can be extended when needed.

Is it possible to translate a clojure syntax into python syntax? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have been looking around but haven't found an example of this. I'd like to write out a few long/tedious python scripts using Clojure. Just because I happen to enjoy Clojure a bit more and they are not full on programs.
This site makes me think it is possible:
http://jkkramer.com/sudoku.html
For example if I have script.clj, I'd like to be able to convert it to script.py - not by hand of course.
Is it possible to do this? If so, what tool/library/script should I use? If its not possible not, why not?
[Edit] I edited this because the wording mistakenly gave the impression I was looking for a detailed lesson on writing my own solution. I was just curious if the tools were out there to answer my question and if not then why not.
Yes. Write a compiler that takes Clojure syntax and outputs valid Python syntax.
How to do that is well outside of the ability/scope of a StackOverflow answer.
Also note that if you do this for the general case of compiling any piece of Clojure code to Python you will have implemented quite a bit of Clojure in Python (especially when you implement defmacro and generic methods).
You actually don't have to do a source to source translation in order to write Clojure that will interact with python libraries. Just see clojure-py which allows you to write regular Clojure syntax and run it under the Python interpreter and call Python libraries.

Looking for a collection of parsers to extract function/class definitions [closed]

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 8 years ago.
Improve this question
I'm preparing to make a little IDE that allows to expand function/macro calls to their definitions right in the place they are called (and do that recursively if needed, so that if funciton A calls B, I expand B, then B calls C - I expand C in the code of B etc.):
Question 1: do you know of existing IDEs with this feature?
Question2: How would you implement that? My approach is as follows: I'd like to have the IDE being able to understand various programming languages. In order to extract function definitions, I'll seemingly have to use parsers. Is there any collection of parsers for various languages? I've looked into Ctags and Pygments lexers, but their output is insufficient to accomplish this task.
Preferable language for IDE is Python (although Java and C suggestions are ok, too), graphial library - gtk+2. Thanks.
Question 1: do you know of existing IDEs with this feature?
Not perhaps quite what you describe, but Visual Studio's Code Definition Window shows the definition of any symbol at the current cursor position. It differs of course in that it shows the definition in a separate window to the editor window, but to be honest I would find your proposition somewhat jarring and counter-intuitive since the calls are not semantically in-line.
What you want is called "goto definition" in most IDEs. Granted, they don't expand inline, but you have to put the definition somewhere.
As a general rules, many IDEs have split windows so the definition can be seen at the same time with the original call. It seems to me that you essentially want to automate the setup of splitting the windows, and going the definition point.
Many IDEs contain internally programmable interfaces. You can probably do with with Eclipse; you could certainly do this with Emacs, if M-x goto-definition-in-new-window isn't already built in :-}

C++ to simpler language (Python, Lua, etc) converter? [closed]

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 know Python and I've come across a small C++ source file I would like to convert to Python. But the C++ code is too complex for me to understand without learning the language.
So I was wondering if there is a tool that does the opposite of what many people want: convert C++ code to Python, or another simpler language I could understand.
I know these tools work on very simple code and hardly do a perfect job even then, but the code I have is pretty small and simple.
I have found "ctopy", but there is no usage example, if I just pass a .cpp file to it, it just hangs, no error message or anything.
And maybe it won't work for C++ at all.
http://www.catb.org/~esr/ctopy/
Most translators produce inferior code which you can't really use anywhere; and the more complicated your code is, the worse the results are. Only real human brains can do that perfectly. I'd suggest that you learn the language. If you already know python, learning another language shouldn't be too difficult.
I've seen (and wanted) such a programming code converter and found exactly what you want in cpp2py although I personally haven't tried it for myself website https://github.com/hlamer/cpp2python
It's a little painful, but I have gotten some python code using
https://code.google.com/p/ctypesgen/
For some reason it doesn't handle bool's.
It probably uses regex substitutions, and other things like that, but it sure beats writing out your own ctypes wrapper without it.
http://docs.python.org/2/library/ctypes.html
Another option you could look into, is compiling your C++ into an executable and then running the executable using python.
And if you decide you need the power of C/C++ in your tool belt:
https://stackoverflow.com/questions/3973899/learning-c-java-coming-from-python
Hope that helps.

Categories

Resources