PEP Java Parser empty terminal word on right sight

114 views Asked by At

I am using a PEP java earley parser. And i have now a question about an empty rule (epsilon(ε)) on the right site:

A -> ε | b | c | b A | c A

How can I define such a rule in java like

List<Category> right = new ArrayList();
right.add(new Category('', true)); //epsilon - empty word
right.add(new Category('b', true));
...
Rule r = new Rule(new Category(A), right);

And how can I use it by parsing in query if none of right terminal can not be applied. So e.g. i have a word, what should be accepted :

b ε
0

There are 0 answers