Topic: 高级问题,能者请进!! (一个java源文件,如何通过语法分析,得到其所有的方法和类? / antlr)

  Print this page

1.高级问题,能者请进!! (一个java源文件,如何通过语法分析,得到其所有的方法和类? / antlr) Copy to clipboard
Posted by: llpdhcasc
Posted on: 2003-09-01 10:08

一个java源文件,如何通过语法分析,得到其所有的方法和类?谢谢!!!

2.Re:高级问题,能者请进!!! [Re: llpdhcasc] Copy to clipboard
Posted by: dog72
Posted on: 2003-09-01 10:16

http://www.antlr.org
上面有你想要的所有东西。

3.Re:高级问题,能者请进!!! [Re: llpdhcasc] Copy to clipboard
Posted by: ditty
Posted on: 2003-09-01 10:27

如果是编译好的class,可以用反射机制。但是,如果是源文件,就不那么容易了!~

4.Re:高级问题,能者请进!!! [Re: llpdhcasc] Copy to clipboard
Posted by: dog72
Posted on: 2003-09-01 10:47

容易的很。懂点编译原理就可以了。

5.Re:高级问题,能者请进!!! [Re: llpdhcasc] Copy to clipboard
Posted by: llpdhcasc
Posted on: 2003-09-01 12:22

谢谢,antlr我已经看过了,不过实在e文有限,所以想问问,有没有一些
好的东西可用?

6.Re:高级问题,能者请进!!! [Re: llpdhcasc] Copy to clipboard
Posted by: dog72
Posted on: 2003-09-01 15:36

antlr就很好了,e文有限可以学吗!
有什么不会的问我好了,还有可以号召论坛上的高手翻译antlr的文档,也算为中国的IT业做贡献了。因为编译是软件的基础,也是中国软件的软肋。各位版主,我的建议要不要采纳呀,专门开一个编译版,这可是中国第一哟!

7.Re:高级问题,能者请进!!! [Re: dog72] Copy to clipboard
Posted by: jameszhang
Posted on: 2003-09-01 15:42

dog72 wrote:
antlr就很好了,e文有限可以学吗!
有什么不会的问我好了,还有可以号召论坛上的高手翻译antlr的文档,也算为中国的IT业做贡献了。因为编译是软件的基础,也是中国软件的软肋。各位版主,我的建议要不要采纳呀,专门开一个编译版,这可是中国第一哟!

支持一下

8.Re:高级问题,能者请进!!! [Re: dog72] Copy to clipboard
Posted by: floater
Posted on: 2003-09-02 01:50

dog72 wrote:
antlr就很好了,e文有限可以学吗!
有什么不会的问我好了,还有可以号召论坛上的高手翻译antlr的文档,也算为中国的IT业做贡献了。因为编译是软件的基础,也是中国软件的软肋。各位版主,我的建议要不要采纳呀,专门开一个编译版,这可是中国第一哟!

*sigh*, don't know. Logically, this is a 2-edge sword. On the one side, we have more chinese IT books so more folks could get the info; on the other side, they'll never learn english and lose the business to competitors, like indians.

9.Re:高级问题,能者请进!! (一个java源文件,如何通过语法分析,得到其所有的方法和类? / antlr) [Re: llpdhcasc] Copy to clipboard
Posted by: dog72
Posted on: 2003-09-02 09:43

Sad那你说咋办呢?

10.Re:高级问题,能者请进!!! [Re: floater] Copy to clipboard
Posted by: jameszhang
Posted on: 2003-09-02 10:31

floater wrote:
*sigh*, don't know. Logically, this is a 2-edge sword. On the one side, we have more chinese IT books so more folks could get the info; on the other side, they'll never learn english and lose the business to competitors, like indians.


也支持!汗颜‘````

11.Re:高级问题,能者请进!! (一个java源文件,如何通过语法分析,得到其所有的方法和类? / antlr) [Re: llpdhcasc] Copy to clipboard
Posted by: emarket
Posted on: 2003-09-02 14:11

javacc呀:)
https://javacc.dev.java.net/

或者一个笨办法,用javac把 源文件 compile到一个临时文件夹,再用classloader将其load,再用reflection api。。。。有点南辕北辙了:)还是直接用javacc好了

12.Re:高级问题,能者请进!! (一个java源文件,如何通过语法分析,得到其所有的方法和类? / antlr) [Re: llpdhcasc] Copy to clipboard
Posted by: dog72
Posted on: 2003-09-02 14:34

4.14 How does JavaCC differ from standard LL(1) parsing?
Well first off JavaCC is more flexible. It lets you use multiple token lookahead, syntactic lookahead, and semantic lookahead. If you don't use these features, you'll find that JavaCC is only subtly different from LL(1) parsing; it does not calculate "follow sets"in the standard way - in fact it can't as JavaCC has no idea what your starting nonterminal will be.

这是什么意思呀?他和LL(1)的Follow Sets有什么区别呀?

13.Re:高级问题,能者请进!!! [Re: jameszhang] Copy to clipboard
Posted by: llpdhcasc
Posted on: 2003-09-02 15:50

其实,也有一个较为**的方法:正则表达式,效果不错,还实惠。

14.Re:高级问题,能者请进!! (一个java源文件,如何通过语法分析,得到其所有的方法和类? / antlr) [Re: llpdhcasc] Copy to clipboard
Posted by: dog72
Posted on: 2003-09-02 16:52

想想看...
单纯处理搂主的问题正则表达式应该是够用了,因为不存在嵌套和递归的文法。
同意楼上的。

15.Re:高级问题,能者请进!!! [Re: dog72] Copy to clipboard
Posted by: yjwang
Posted on: 2003-09-02 17:12

dog72 wrote:
antlr就很好了,e文有限可以学吗!
有什么不会的问我好了,还有可以号召论坛上的高手翻译antlr的文档,也算为中国的IT业做贡献了。因为编译是软件的基础,也是中国软件的软肋。各位版主,我的建议要不要采纳呀,专门开一个编译版,这可是中国第一哟!

支持一下.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923