You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In initializing arith module, the following parse_term call:
parse_term @"!m. m + 0 = m"
produces StackOverflowException. The same applies for subsequent parse_term calls.
This is probably related to parse_as_infix commands since if one comments out these commands in the beginning of arith module, StackOverflowException doesn't occur in some cases.
The text was updated successfully, but these errors were encountered:
My guess as to the cause of this issue is the way the parser-combinators are designed. Specifically, the parser-combinators handle alternatives/backtracking via throwing and catching exceptions; if one alternative doesn't match an input string, the parser will throw an exception which will be caught, then the second parser will be tried. Unfortunately, the second parser is called from within the catch part of the handler (with in F#), and for safety/security reasons the CLR does not allow tail-calls from within a protected block (try) or a handler (catch, finally, fault, filter).
This would explain why we only get the stack overflows in certain cases -- those are the cases where many alternatives have been added to the parser, and the parser for the string you're trying to parse (e.g., !m. m + 0 = m) is too far down the list of alternatives.
I expect this issue will be remedied whenever I get around to re-implementing the parsers (and related code) using FParsec.
In initializing arith module, the following
parse_term
call:produces StackOverflowException. The same applies for subsequent
parse_term
calls.This is probably related to
parse_as_infix
commands since if one comments out these commands in the beginning ofarith
module, StackOverflowException doesn't occur in some cases.The text was updated successfully, but these errors were encountered: