abstract-syntax-tree

Is it possible the get the AST for an OCaml program?

I'd like to be able to get the AST for a given OCaml program (I'd like to walk the AST and generate an instrumented version of the code or do some kind of transformation, for example). Do any of the OCaml tools support this functionality? ...

how to write a Python debugger/editor

Sorry for the kind of general question. More details about what I want: I want the user to be able to write some Python code and execute it. Once there is an exception which is not handled, I want the debugger to pause the execution, show information about the current state/environment/stack/exception and make it possible to edit the co...

Algorithm to build syntax tree from prefix order expression

What type of algorithm would be used to construct a syntax tree from an expression represented in prefix order notation? ...

Given an AST, is there a working library for getting the source?

Is there a way to convert a given Python abstract syntax tree (AST) to a source code? Here is a good example of how to use Python's ast module, specifically a NodeTransformer. I was looking for a way to convert the resulting AST back to source, so the changes can be inspected visually. ...

How can I get the syntax tree from a coderef in Perl?

I'd like to inspect and manipulate code of arbitrary Perl procedures (got by coderefs) in Perl. Is there a tool/module/library for that? Something similar to B::Concise, except that B::Concise prints the code on output, but I'd like to inspect it programmatically. I'd like to use it like this. Given a coderef F, which is called eg. with...

What's the use of abstract syntax trees?

I am learning on my own about writing an interpreter for a programming language, and I have read about Abstract Syntax Trees. I have an idea of what they are, but I do not see their use. Why are ASTs useful? ...