- Ocamlmerlin, entry point, environment setup, main loop
- Main_args, argument parsing, taken from original OCaml distribution
- Command, definition of toplevel commands
- Json, alias of Yojson.Basic, Json format used for toplevel communication
- Protocol, helpers for (de)serialization of json
- Error_report, pretty-printing of errors from different levels (environment, lexer, parser, typer, …)
Port of original OCaml parser to menhir with a lot of modification.
- Lexer
- Outline_parser, split input in group of tokens that can be parsed separately
- Outline_utils, helpers to setup and use Outline_parser − Chunk_parser_utils, routines related to Chunk_parser
- Chunk_parser, parse chunk of tokens from Outline_parser into independent definitions
- Extensions, type signatures to mimic behavior of syntax extensions
- Fake, rewrite AST to handle syntax extensions
See typing/ Almost the original OCaml typer with a few changes (error handling, recovery, …).
- History, zipper-like structure maintaining incrementally refined parse tree, typing environments, etc
- Outline, takes raw input, produces chunks of token, see Outline_parser
- Chunk, takes chunks of token, produces chunks of AST
- Typer, takes chunks of AST, incrementally extends typing environment
- Browse, quick'n'dirty prototype easing navigation in Typedtree, Env, etc to extract information relevant for typing and completion TODO: extract completion, typing and pretty-printing code from Command to a specialised module
A syntax extension is constituted of one or more of the following part:
- extension of Outline_parser and Chunk_parser to extend grammar and introduce new tokens
- extension of Lexer, usually by introducing new keywords corresponding to tokens
- new definitions in Fake used in Chunk_parser to rewrite new grammar constructions into classic OCaml AST
- new definitions in Extension to provide special primitives for typing Fake generated AST