What is a good BNF grammar testing tool?

I am writing an iPhone application that needs to parse a relatively simple set of expressions to be entered by the user.

I need a tool that allows me to introduce BNF (E) for the grammar, tell me if it is error-free, and tell me which parser is required to parse it, and also let me check if the expressions execute or not parse according to this grammar . This tool can be Objective-C, Java, or the command line. The simpler and cheaper the better.

Bison does not seem to allow me to enter my BNF as-is, and the effort required to test expressions against the resulting analyzer is a larger Yacc-shaving (ha!) Exercise than I am willing to participate.

Can someone point me to the active Java library, which will allow me to specify the grammar as BNF, check it and create a parser from it, which I can then use in JUnit tests, or a command line tool that will allow me to do something like this ?

+4
source share
2 answers

I suggest ANTLR . It is common and has a decent little IDE / test posting at ANTLRWorks .

+2
source

Usage may use JavaCC. http://javacc.java.net/ It is quite easy to use.

0
source

Source: https://habr.com/ru/post/1441948/


All Articles