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_heading : line_operand option;
  4. c_heading_span : Error.span option;
  5. c_span : Error.span;
}
type toward =
  1. | TowardPoint of point_operand
  2. | TowardLine of line_operand
type toward_item = {
  1. target : toward;
  2. subject : align_object option;
}
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 sides = {
  1. s_toward : toward_item option;
  2. s_moving : flap_arg option;
  3. s_spans : side_spans;
}
and side_spans = {
  1. toward_span : Error.span option;
  2. moving_span : Error.span option;
}
val no_side_spans : side_spans
type fold_spec = {
  1. moving : flap_arg option;
  2. toward : toward_item option;
  3. up_to : flap_arg option;
  4. direction : direction;
  5. place : (place_dir * flap_arg) option;
  6. spans : side_spans;
}
type reverse_spec = {
  1. rmoving : flap_arg option;
  2. rtoward : toward_item option;
  3. outside : bool;
  4. rletters : (line_operand * bool * Error.span) list;
  5. rspans : side_spans;
}
type mv_constraint =
  1. | MvFree
  2. | MvMountain
  3. | MvValley
type collapse_elem = {
  1. cline : line_operand;
  2. cdir : mv_constraint;
}
type number =
  1. | NLit of Q.t * Error.span
  2. | NParam of string * Error.span
type free_pos =
  1. | FreeAt of number
  2. | FreeBy of number
type point_expr =
  1. | PsExpr of point_operand
  2. | PsFree of {
    1. line : line_operand;
    2. anchor : point_operand;
    3. pos : free_pos 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. | RiMovingDir of flap_arg * bool * Error.span
  5. | RiUpTo of flap_arg * Error.span
  6. | RiLetter of mv_constraint * Error.span
  7. | RiPlace of place_dir * flap_arg * Error.span
  8. | RiOutside of Error.span
  9. | RiOn of flap_arg * Error.span
  10. | RiExtent of extent * Error.span
  11. | RiOrder of flap_arg * flap_arg * Error.span
  12. | RiStaying of point_operand list * Error.span
  13. | RiSelection of toward_item * Error.span
  14. | RiAlignment of line_operand * align_object * 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 * sides * Error.span
  3. | Mark of output * markable * extent * direction * flap_arg option * sides * Error.span
  4. | Fold of output * markable * fold_spec * Error.span
  5. | Reverse of output * markable * reverse_spec * Error.span
  6. | Unfold of line_operand * fold_spec * Error.span
  7. | BindBundle of string * line_operand * Error.span
  8. | Point of string * point_expr * Error.span
  9. | Flip of Error.span
  10. | Def of string * param list * stmt list * Error.span
  11. | Apply of string option * string * arg list * Error.span
  12. | Export of export_entry list option * string * Error.span
  13. | Squash of output * line_operand * align_object * Error.span
  14. | Flatten of output * collapse_elem list * (flap_arg * flap_arg) list * point_operand list option * flap_arg option * point_operand option * Error.span
type sheet =
  1. | SSquare of number option * Error.span
  2. | SShape of string * number list * Error.span
type shape_def = {
  1. sd_name : string;
  2. sd_name_span : Error.span;
  3. sd_params : (string * Error.span) list;
  4. sd_sheet : sheet;
  5. sd_body : stmt list;
  6. sd_trim : flap_arg * Error.span;
  7. sd_exports : export_entry list option;
  8. sd_span : Error.span;
}
type program = {
  1. p_unit : (string * Error.span) option;
  2. p_shapes : shape_def list;
  3. p_sheet : sheet;
  4. p_stmts : stmt list;
}