abstract-syntax-tree

Eclipse Java AST parser: insert statement before if/for/while

巧了我就是萌 提交于 2020-01-14 03:05:54
问题 I'm using the org.eclipse.jdt parser. I want to rewrite this code: public void foo(){ ... ... if(a>b) ... ... } into this: public void foo(){ ... ... System.out.println("hello"); if(a>b) ... ... } Supposing that ifnode is an IF_STATEMENT node, I can do something similar to this: Block block = ast

How to write a Typescript plugin?

为君一笑 提交于 2020-01-13 20:17:27
问题 Are there any docs / examples of writing a Typescript plugin? For the last time I am very inspired with the idea of bringing Typescript into my projects. However, currently I see this is not possible because of my failed attempts to find any docs about writing a Typescript plugin . I need this

Eclipse JDT ASTParser convert enum declaration node incorrectly

左心房为你撑大大i 提交于 2020-01-13 03:47:19
问题 I am working on analyzing Java code by using JDT and going to build a standalone analysis tool depend on org.eclipse.jdt.core package instead of an eclipse plug-in. But I found that my tool did not work correctly on enum declaration node which appeared in Java code. In my AST which created by jdt

Building a control-flow graph from an AST with a visitor pattern using Java

耗尽温柔 提交于 2020-01-12 03:53:10
问题 I'm trying to figure out how to implement my LEParserCfgVisitor class as to build a control-flow graph from an Abstract-Syntax-Tree already generated with JavaCC. I know there are tools that already exist, but I'm trying to do it in preparation for my Compilers final. I know I need to have a data

Developing Abstract Syntax Tree

坚强是说给别人听的谎言 提交于 2020-01-11 15:30:15
问题 I've scoured the internet looking for some newbie information on developing a C# Abstract Syntax Trees but I can only find information for people already 'in-the-know'. I am a line-of-business application developer so topics like these are a bit over my head, but this is for my own education so I

How to avoid building intermediates and useless AST nodes with ANTLR3?

耗尽温柔 提交于 2020-01-11 07:09:16
问题 I wrote an ANTLR3 grammar subdivided into smaller rules to increase readability. For example: messageSequenceChart: 'msc' mscHead bmsc 'endmsc' end ; # Where mscHead is a shortcut to : mscHead: mscName mscParameterDecl? timeOffset? end mscInstInterface? mscGateInterface ; I know the built-in