Parsing Java Source Code

前端 未结 9 1841
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 07:20

I am asked to develop a software which should be able to create Flow chart/ Control Flow of the input Java source code. So I started researching on it and arrived at followi

9条回答
  •  自闭症患者
    2021-01-12 08:10

    Now I have two ways of recognizing:

    You have many more ways than that. JavaCC ships with a Java 1.5 grammar already built. I'm sure other parser generators ditto. There is no reason for you to either have to write your own grammar or construct your own parser.

    And specifically 'read[ing] input source code files as text and search for the specific patterns' isn't a viable choice at all, as it isn't parsing, and therefore cannot possibly recognize Java programs correctly.

提交回复
热议问题