package ppxlib_jane

  1. Overview
  2. Docs

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.

module Comprehensions : sig ... end

The ASTs for list and array comprehensions

module 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).

module Mode_expr : sig ... end

Mode_expr appears in several places:

module N_ary_functions : sig ... end

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

module 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.

module 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).

module Strengthen : sig ... end

The ASTs for module type strengthening.

module Layouts : sig ... end

The ASTs for jkinds and other unboxed-types features

module 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.

module Core_type : sig ... end

Novel syntax in types

module Constructor_argument : sig ... end

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

module Expression : sig ... end

Novel syntax in expressions

module Pattern : sig ... end

Novel syntax in patterns

module Module_type : sig ... end

Novel syntax in module types

module Signature_item : sig ... end

Novel syntax in signature items

module Structure_item : sig ... end

Novel syntax in structure items

module Extension_constructor : sig ... end

Novel syntax in extension constructors

OCaml

Innovation. Community. Security.