Regexp result;
if (x.isEmpty() && !canGenerateEmptyString){
result = null;
}else if (x.isEmpty() && canGenerateEmptyString){
Hampi h = new Hampi();
result = h.constRegexp("");
}else if (x.size() == 1){
result = x.get(0);
}else{
Hampi h = new Hampi();
result = h.orRegexp(x.toArray(new Regexp[x.size()]));
}
regexpCache.put(startSymbol, bound, result);
return result;
}