本文介绍了Javascript解析器生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我见过一些javascript解析器生成器:I've seen some javascript parser generators: Jison(http://zaach.github.com/jison/ ) PEG.js( http://pegjs.majda.cz/ ) ANTLR( http://www.antlr.org/ ) JS / CC( http://jscc.jmksf.com/ )有没有任何人有他们的经验?Does any one have any experience with them?有什么优点和缺点?这些库是否准备好生产?和性能?What are the pros and cons? Are these libraries ready for production? And performance? 编辑: 我想在javascript中解析并运行其他语言EDIT:I want to parse and run a different language in javascript推荐答案我不知道你想要一个解析器生成器,它会吐出一个JavaScript写的解析器或解析器生成器,使用JavaScript语法来构建一个JavaScript解析器。I'm not sure if you want a parser generator that would spit a JavaScript written parser or a parser generator that would use a JavaScript grammar to build a JavaScript parser.无论如何,我只使用ANTLR和JavaCC。 ANTLR允许您使用不同的语言(C,C#,Java)生成解析器,并且在GUI树状表单上检查您的上下文无关语法表达式非常简单。从来没有找到一个JavaScript语法。Anyway, I've only used ANTLR and JavaCC. ANTLR allows you to generate your parser in different languages (C, C#, Java) and it's pretty cool checking your Context-free grammar expressions on their GUI tree-like form. Never found a JavaScript grammar for it though. JavaCC有一个缺点。只在Java中生成解析器。另一方面,我发现它更容易学习,并从你构建解析器的部分 - 我发现是最好的部分 - 构建任何你想要的周围,例如,代码翻译,rephraser等等。JavaCC has a downside. Only generates the parser in Java. On the other hand, I found it easier to learn and to step from the part where you build the parser to - what I found to be the best part - building whatever you want around it e.g., code translator, rephraser, etc, etc. 这篇关于Javascript解析器生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!