package ppxlib_jane

  1. Overview
  2. Docs

Module Ppxlib_jane.Jane_syntaxSource

Syntax for Jane Street's novel syntactic features. This module provides three things:

1. First-class ASTs for all syntax introduced by our language extensions, plus one for built-in features; these are split out into a different module each (Comprehensions, etc.).

2. A first-class AST for each OCaml AST, unifying all our novel syntactic features in modules named after the syntactic category (Expression.t, etc.).

3. A way to interpret these values as terms of the coresponding OCaml ASTs, and to match on terms of those OCaml ASTs to see if they're terms from our novel syntax.

We keep our novel syntax separate so that we can avoid having to modify the existing AST, as this would break compatibility with every existing ppx and other such tooling.

For details on the rationale behind this approach (and for some of the gory details), see Jane_syntax_parsing.

Sourcemodule Comprehensions : sig ... end

The ASTs for list and array comprehensions

Sourcemodule Immutable_arrays : sig ... end

The ASTs for immutable arrays. When we merge this upstream, we'll merge these into the existing P{exp,pat}_array constructors by adding a mutable_flag argument (just as we did with T{exp,pat}_array).

Sourcemodule Mode_expr : sig ... end

Mode_expr appears in several places:

Sourcemodule N_ary_functions : sig ... end

These types use the P prefix to match how they are represented in the upstream compiler

Sourcemodule Labeled_tuples : sig ... end

The ASTs for labeled tuples. When we merge this upstream, we'll replace existing P{typ,exp,pat}_tuple constructors with these.

Sourcemodule Include_functor : sig ... end

The ASTs for include functor. When we merge this upstream, we'll merge these into the existing P{sig,str}_include constructors (similar to what we did with T{sig,str}_include, but without depending on typechecking).

Sourcemodule Strengthen : sig ... end

The ASTs for module type strengthening.

Sourcemodule Layouts : sig ... end

The ASTs for jkinds and other unboxed-types features

Sourcemodule type AST = sig ... end

The module type of our extended ASTs for our novel syntax, instantiated once for each syntactic category. We tend to call the pattern-matching functions here with unusual indentation, not indenting the None branch further so as to avoid merge conflicts with upstream.

Sourcemodule Core_type : sig ... end

Novel syntax in types

Sourcemodule Constructor_argument : sig ... end

Novel syntax in constructor arguments; this isn't a core AST type, but captures where global_ lives

Sourcemodule Expression : sig ... end

Novel syntax in expressions

Sourcemodule Pattern : sig ... end

Novel syntax in patterns

Sourcemodule Module_type : sig ... end

Novel syntax in module types

Sourcemodule Signature_item : sig ... end

Novel syntax in signature items

Sourcemodule Structure_item : sig ... end

Novel syntax in structure items

Sourcemodule Extension_constructor : sig ... end

Novel syntax in extension constructors