Angstrom tutorial

At the end of the Angstrom tutorial Quick and Dirty Guide to Monadic Parsers and Angstrom | OCamlverse, three pieces of advice are given. The second one is to separate lexical and semantic analyses, but it does not point to examples of that. Do you know of good (nontrivial nor too complex) examples ? If you have the rights, it looks like the page is even editable. Is the semantic part also intended to be done by Angstrom, or is Angstrom’s job restricted to the first part ?

Also, that paragraph talks of “doing a second (or even third) pass over the AST”. Wouldn’t it be more correct to say that these following passes, the ones corresponding to the semantic analysis, take a CST (concrete syntax tree) to build an AST ? (This question is not nitpicking, it’s to be sure I understand correctly.)

Finally, it looks like “lexical analysis” there is meant to group lexical and syntactic analyses (lexer and parser). I know the boundary between both can be blurry, but is it what is usually done in Angstrom, or is it possible / desirable to also have a clear separation, so as to have the three phases:

  • lexical analysis (char stream → token stream),
  • syntactic analysis (token stream → CST),
  • semantic analysis (CST → AST).