i have a parser that is effectively a set of recursive functions operating on a sequence of lexer tokens. The problem i'm running into is that the sequence seems to restart from the beginning on recursive function calls. Given the following skeleton definition for function Parse
let restricted = Seq.take_while token_search tokens
let compiled_nodes = Seq.fold (fun list (next: Lexer.Token) -> list @ parse_token this restricted next) [] restricted
the function parse_token
may result in a call into Parse
. However, when that happens, the parameter tokens
ends up positioned at the beginning of the sequence. Any ideas on how to keep the sequence positioned where it needs to be?
tia