페이지

2012년 11월 10일 토요일

how to use DOM AST in CDT


update 2012/11/10:
 I created separate plugin to provide DOM AST viewer called ASTViewer. You can install it using the following update site :
https://raw.github.com/nberserk/ASTViewer/master/org.eclipse.cdt.ui.astviewer.update 

for more details information see here : https://github.com/nberserk/ASTViewer


I can't find any useful resources yet. so I share this information on my blog.
DOM AST viewer shows Abstract Syntax Tree of C/C++ program in tree manner. very useful for AST related work. I don't know Why this viewer is included in test plugin. that's why we can't use it in official CDT.

anyway, here is how to use DOM AST :
  • first get CDT source from CDT repository: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git
    you can get source code for each released version here. e.g. > CDT_8_0_2.zip
  • copy CDT_8_0_2.zip/CDT_8_0_2/core/org.eclipse.cdt.ui.tests to your hard drive
  • import org.eclipse.cdt.ui.tests
  • remove build error ( i removed all source files except org.eclipse.cdt.ui.tests.DOMAST)
  • run
  • Window->Show View -> C/C++ -> DOM AST
  • done





댓글 6개:

  1. Thank you for this post!
    I downloaded the sources for 8.0.2 (I am using eclipse Juno Build id: 20120614-1722). From sources I left only the org.eclipse.cdt.ui.tests.DOMAST and org.eclipse.cdt.ui.testplugin (in the second one I commented some erronous code and got the DOMAST working.

    답글삭제
  2. I installed ASTViewer, enabled the view in Window->Show View->Other->C/C++, the tab "ASTViewer" appeared, but it is always empty, even when I click on .cpp files in my project or open them. I don't understand why, how can I learn about the cause of this issue and/or fix it?

    I then tried to use DOM AST, but I don't understand the "import org.eclipse.cdt.ui.tests" step. I tried Window->Import but I have no idea what to choose from the options :( I'm using Eclipse Juno, CDT version 8.1.1.

    답글삭제
    답글
    1. the updatesite i uploaded at github is for Indigo, not for Juno.

      anyway the steps i mentioned is equally applied to Jubo plugins.
      the import can be performed in File>Import>Genernal>Existing Project into workspace.

      hope this helps

      삭제
    2. Thanks Darren, I can finally use DOM AST. By the way, I found that an alternative solution to removing source files from org.eclipse.cdt.ui.tests to fix the build error is to import org.eclipse.cdt.core.tests as well.

      삭제
    3. thanks for sharing information

      삭제