I would like to instrument Javascript code in order to "log" values of global variables. For example I would like to know all the values a particular variables foo had during execution. The logging is not the problem.
Do any of you know what would be the easiest way to implement this? I was thinking of using Rhino (the Javascript impleme...
Hi,
is there a way (and if so, how ?) to traverse a XPath query recursively ?
I have an AST in Java with the following scenario
@Relevant
public void foo() {
bar(true);
}
public void bar(boolean flag) {
assert flag;
}
I want to find the method which is annotated with '@Relevant' (thats easy) and check if the method which is ca...
Would it be possible to use groovy ast transformations code to manipulate java classes?
If yes, please give an example.
If no, please specify why.
...
I'm looking to generate an XML representation of the AST for a given java class (by parsing its source). Overall, what I want to do is write XSLT queries to find meta patterns in the source code - very much like PMD does.
There was an open source utility that started this, but went stale. Anyone know of a utility to do this?
-Mike
...
I have a general idea of what an AST is, but I want to know how to construct one.
If you're given a grammar and a parse tree, how do you construct the AST?
How do you do it if you're given a grammar and an expression?
...
AST Transformations are implemented in Groovy. What's a practical example of using an AST Transformation?
...
Hello everyone,
I'm currently pondering how best to take an AST generated using Antlr and convert it into useful objects which I can use in my program.
The purpose of my grammar (apart from learning) is to create an executable (runtime interpretted) language.
For example, how would I take an attribute sub-tree and have a specific A...
i'm looking for a software which converts a c source code program to a xml-based ast representation? some sort of markup language.
example:
[function name="set_foo"]
[parameters]
[parameter name="bar" type="string" /]
[/parameters]
[return>
...
I have a Python AST [as returned by ast.parse()].
I know this is an AST of a class method.
How do I find all calls to other methods of the same class?
Basically, I want to collect something like:
['foo', 'bar']
for a code snippet like:
def baz(self): # this is a class method
'''baz docstring'''
self.foo() + self.bar()
I ...
Hi there,
I am building up some statistics after analyzing the source code in eclipse. But the overall process is too slow because i rebuild my model every time from scratch after each compilation.
I am looking for a way to get only the changed parts of the code (as ASTNodes) and to rebuild just that part of my model. I suppose that ev...
Hi,
I have an Java AST and I try to find a variable inside it via XPath.
Lets say the variable is called 'foobar' I could use
//VariableDeclarator/VariableDeclaratorId[@Image='foobar']
but what if I dont know the text 'foobar', but want to read it from another element
//VariableDeclarator/VariableDeclaratorId[@Image=//Synchroni...
Hi,
again I have Java AST which is created from
public class Test {
String o = new String("hh");
public void wrong1() {
synchronized(o) {
// huhu
}
}
}
I try to create a XPath query which finds the synchronized block in which the defined String variable o is used.
As the definition is above it...
I am generating the scala AST using the following code:
val setting = new Settings(error)
val reporter = new ConsoleReporter(setting, in, out) {
override def displayPrompt = ()
}
val compiler = new Global(setting, reporter) with ASTExtractor{
override def onlyPresentation = true
}
//setting.PhasesSetting("...
Hi,
Is there any best practice when working with AST:s?
I have a parsed expression AST. ConstantExpression, BinaryExpression etc.
I want to populate a GUI-dialog with information from the AST, and it's here where I get kinda confused because my code gets pretty messy.
Example:
expression = "Var1 > 10 AND Var2 < 20"
I want to popula...
As the title says, I want to parse some Java source code in Java. I'm pretty sure there are other java libraries that already perform this, but I couldn't find any.
...
I was wondering if there is something similar to GCC_XML for C#3; basically a way to represent a program's entire syntactic structure in XML.
Once the representation is created, I was hoping to parse it into an XDocument and interpret or query it from there.
Are there tools out there for this?
...
i wanna get a xml representation of the ast of java and c code. 3 months ago, i asked this question yet but the solutions weren't comfortable for me
srcml seems to be a good solution for this problem but it does not support line numbers and columns but i need that feature.
about elsa: cite: "There is ongoing effort to export the Elsa A...
I am writing a small tool for analyzing simple B Machine substitutions as part of a college research work. The code successfully parse test inputs of the form mySubst := var1 + var2. However, I get a pop-up error message saying "This application has requested the Runtime to terminate it in an unusual way. " In the command prompt window, ...
I am reading the book Language Implementation Patterns (http://tiny.cc/235xs) amongst a few others mixed in to clarify concepts as well as the occasional website. I am trying to make a tool that reads a trivial programming language and performs some basic analysis on it.
I am getting stuck in the design phase of this tool. I have constr...
Is there a way to use jdt ASTParser to get the value of a String field declared in a java file. Actually what I need is to resolve any possible dependencies from other classes e.g.
public String str = "somethig"+SomeTherClass.SOMETHING_ELSE.
...