Looking for a way to parse SNMP Mib Files in Ruby, I found a project written in Java (www.mibble.org) that use two files of Grammar (extension .grammar) to parser Mib files. Is there any way to use grammar files with ruby?

有帮助吗?

解决方案

http://grammatica.percederberg.net

If you dig further you will see the grammar file is for Grammatica, which only supports Java and C#.

Either you extend Grammatica to support Ruby or you will have to switch to other approaches. Note that Mibble is released GPL and a commercial license. If you are going to reuse the grammar file, make sure you meet the licensing requirements.

Our open source project, http://sharpsnmplib.codeplex.com uses ANTLR 3 to parse MIB documents. The grammar file is released under BSD 3 Clause. As ANTLR does support Ruby, http://www.antlr.org/wiki/display/ANTLR3/Antlr3RubyTarget, you might reuse our MIB grammar.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top