Yes it is possible.
The following is a related article by FParsec. If you want to delve into this topic, this document can be read. The document notes that there are several packages for parsing based on indentation based on Parsec, a parser combinator that inspires FParsec.
FParsec does not have a separate lexing phase, but instead fuses lexing and parsing into a single phase. IMO-indented initialization is best done with parser combinators (FParsec) than parser generators (fslex / fsyacc). The reason is that you need to manually track the current indentation and report good context-based error messages.
source share