Grammar inference library?

余生长醉 提交于 2019-11-28 05:09:02

问题


What are the best (or any) open source libraries for regular or context-free grammar inference from a set of examples believed to be generated by a common grammar? I'd prefer a good library in Java, Python or Ruby, but of course beggars can't be choosers.

I did some googling, but couldn't find any actual implementations, though I did find plenty of interesting references. This library looks interesting, but I couldn't find it available for download anywhere.

Edit (2011-11-14): For clarity (though I'm not sure how you all misunderstood), the question was about grammar inference, not grammar generation or parsing. In other words, given a set of strings which accord to an unknown grammar, find the most restrictive grammar which they all satisfy.


回答1:


I have not used them yet, but I had this identical question and (after much searching) found these two libraries, at very least:

  • libalf for C++
  • gitoolbox for MATLAB

Unlike the other answers to the question, these are actual grammar inference libraries rather than parser generators.




回答2:


You can have a look at antlr - http://www.antlr.org/ and see if its what you're looking for.




回答3:


Take a look at Parboiled: https://github.com/sirthias/parboiled It doesn't generates any sources, just create a class in your app, define a model in it, and make a call from your code.



来源:https://stackoverflow.com/questions/5958483/grammar-inference-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!