/src/parser/spider_monkey_ast.ml
: The type definitions for the AST. Tries to stay very close to ESTree/src/parser/lexer_flow.mll
: The ocamllex lexer logic/src/parser/parser_flow.ml
: The recursive descent JS parser
/src/typing/type_inference_js.ml
: Contains the "entry point" for inference (Function calledinfer_ast
)./src/typing/statement.ml
: Most of the inference logic (runs through the AST and generates the initial constraints)/src/typing/env_js.ml
: Most of the environment logic. An inference "env" is basically a stack of scopes -- which are defined inscope.ml
.
/src/typing/flow_js.ml
: Contains the massive pattern-match that defines the various rules for what to do during the "evaluation" phase when we encounter any given flow constraint. Helpful hint: Flow constraints are defined in terms of 2 types: A "lower bound" and an "upper bound". The "lower bound" is the type that flows into the "upper bound". When you see variables namedl
that often means "lower bound", andu
often means "upper bound".