Javascript parser of simple LL1 Grammar