Module Beloch.Ast

Abstract syntax for Beloch. Spans point into the source for diagnostics.

type point_ref = {
  1. name : string;
  2. span : Error.span;
}
type crease_ref = {
  1. cname : string;
  2. cspan : Error.span;
}
type param = {
  1. pkind : [ `Point | `Line ];
  2. pname : string;
  3. pspan : Error.span;
}
type export_entry = {
  1. ekind : [ `Point | `Line ];
  2. esrc : string;
  3. eshadow : bool;
  4. erename : string option;
  5. espan : Error.span;
}
type point_operand =
  1. | PNamed of point_ref
  2. | PSelect of line_operand list * Error.span
and line_operand =
  1. | LNamed of crease_ref
  2. | LFilter of line_operand * filter_elt * Error.span
  3. | LUnion of line_operand list * Error.span
  4. | LSelect of selector list * Error.span
and filter_elt =
  1. | Keep of selector
  2. | Drop of selector
and selector =
  1. | SelPoint of point_operand
  2. | SelLine of line_operand
  3. | SelFlap of flap_operand
and flap_operand =
  1. | FByPoints of point_operand list * Error.span
type arg =
  1. | APoint of point_operand
  2. | ALine of line_operand
type align_object =
  1. | AoPoint of point_operand
  2. | AoLine of line_operand
and alignment_kind =
  1. | AlOnto of align_object * align_object
  2. | AlThrough of point_operand
  3. | AlPerp of line_operand
and alignment = {
  1. al_fold_line : string option;
  2. al_fold_line2 : string option;
  3. al_kind : alignment_kind;
  4. al_span : Error.span;
}
and construction = {
  1. c_fold_lines : string list;
  2. c_alignments : alignment list;
  3. c_toward : point_operand option;
  4. c_span : Error.span;
}
type direction =
  1. | Valley
  2. | Mountain
type extent =
  1. | Full
  2. | Between of point_operand * point_operand
  3. | At of point_operand
type flap_arg =
  1. | FlapPoint of point_operand
  2. | FlapLine of line_operand
  3. | FlapSpec of flap_operand
type place_dir =
  1. | PlaceOver
  2. | PlaceUnder
type fold_spec = {
  1. moving : flap_arg option;
  2. up_to : flap_arg option;
  3. direction : direction;
  4. place : (place_dir * flap_arg) option;
}
type reverse_spec = {
  1. rmoving : flap_arg option;
  2. outside : bool;
}
type mv_constraint =
  1. | MvFree
  2. | MvMountain
  3. | MvValley
type collapse_elem = {
  1. cline : line_operand;
  2. cdir : mv_constraint;
}
type point_expr =
  1. | PsExpr of point_operand
  2. | PsFree of {
    1. line : line_operand;
    2. anchor : point_operand;
    3. t : Num.t option;
    4. span : Error.span;
    }
type markable =
  1. | MConstruction of construction
  2. | MLine of line_operand
type output =
  1. | Anonymous
  2. | Named of string * bool * Error.span
  3. | Into of string * Error.span
type raw_item =
  1. | RiConstruction of construction * Error.span
  2. | RiLine of line_operand * mv_constraint * Error.span
  3. | RiMoving of flap_arg * Error.span
  4. | RiUpTo of flap_arg * Error.span
  5. | RiLetter of mv_constraint * Error.span
  6. | RiPlace of place_dir * flap_arg * Error.span
  7. | RiOutside of Error.span
  8. | RiOn of flap_arg * Error.span
  9. | RiExtent of extent * Error.span
  10. | RiOrder of flap_arg * flap_arg * Error.span
  11. | RiStaying of flap_arg * Error.span
  12. | RiSelection of point_operand * Error.span
type annot_value =
  1. | AvPoint of point_operand
  2. | AvLine of line_operand
  3. | AvFlap of flap_operand
  4. | AvConstruction of construction
  5. | AvText of string
  6. | AvNumber of Q.t
  7. | AvWord of string
type annot_arg = {
  1. av : annot_value;
  2. av_span : Error.span;
}
type annotation = {
  1. a_ns : string option;
  2. a_key : string;
  3. a_args : annot_arg list;
  4. a_span : Error.span;
}
type stmt =
  1. | Annotation of annotation
  2. | BindLine of string * construction * Error.span
  3. | Mark of output * markable * extent * direction * flap_arg option * Error.span
  4. | Fold of output * markable * fold_spec * Error.span
  5. | Reverse of output * markable * reverse_spec * Error.span
  6. | BindBundle of string * line_operand * Error.span
  7. | Point of string * point_expr * Error.span
  8. | Flip of Error.span
  9. | Def of string * param list * stmt list * Error.span
  10. | Apply of string option * string * arg list * Error.span
  11. | Export of export_entry list option * string * Error.span
  12. | Flatten of output * collapse_elem list * (flap_arg * flap_arg) list * flap_arg option * point_operand option * Error.span
type program = stmt list