parsing - Stackoverflow error on android using scala parsers -
how possible stackoverflowerror using scala parsers in android? using code:
val parseeapply: parser[eapply] = ("eapply" ~> "(" ~> parseexpression) ~ ("," ~> parselistexpression <~ ")") ^^ { case e ~ l => eapply(e, l) } by rewriting using different parenthesis, got rid of error. can explain me why ? eapply expression can contain other expressions, , list of expressions.
val parseeapply: parser[eapply] = "eapply(" ~> parseexpression ~ ("," ~> parselistexpression <~ ")") ^^ { case e ~ l => eapply(e, l) } so why there might recursion error in first , not in second?
i able partially solve problem regrouping parsers in pairs. instead of:
val parseexpression = p1 | p2 | p3 | p4 | p5 | p6 | p7 | p8 i wrote parentheses
val parseexpression = ((p1 | p2) | (p3 | p4)) | ((p5 | p6) | (p7 | p8)) and worked without complaints.
Comments
Post a Comment