izb
izb

Reputation: 51860

JavaME-suitable grammar compiler recommendations?

I want to parse some data, and I have a BNF grammar to parse it with. Can anyone recommend any grammar compilers capable of generating code that can be used on a mobile device?

Since this is for JavaME, the generated code must be:

Upvotes: 3

Views: 169

Answers (2)

brianegge
brianegge

Reputation: 29892

The first question is do you have an existing grammar definition? When I've ported a LALR grammar to Java, I've used JFlex/CUP.

If your starting from scratch, I'd suggest you use JavaCC/FreeCC, which is an LL(k) parser. It's quite well documented and there are not runtime dependencies.

Upvotes: 1

Michael Myers
Michael Myers

Reputation: 192035

I have used JFlex before, and I know it satisfies your second and third requirements. But I don't know how big the generated code might be. According to the manual, it generates a packed DFA table by default, so it might not be too bad.

Upvotes: 1

Related Questions