How to model java classes representing a recursive grammar?

时间:2017-06-20 12:33:40

标签: java recursion grammar context-free-grammar

I have this simple recursive grammar:

T --> a | aT

Are there some best practices?

Anyway, my idea is pretty simple but I am not sure if it is a good one.

public abstract class Tclass {

}

public class Tclass1 extends Tclass{

private String a;

}

public class Tclass2 extends Tclass{

private String a;
private Tclass t;

}

0 个答案:

没有答案