aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/dead_end.ml
blob: bb7826362eb42b6442d3a9b212c8866c1bcfcc02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
open StdLabels

type pos = Lexing.position * Lexing.position
type ('a, 'b) variable = { pos : 'a; name : string; index : 'b option }

module Expression = Default.Expression

module Instruction = struct
  type expression = Default.Expression.t' S.repr
  type repr = unit

  (** Call for an instruction like [GT] or [*CLR] *)
  let call : pos -> string -> expression list -> repr = fun _ _ _ -> ()

  (** Label for a loop *)
  let location : pos -> string -> repr = fun _ _ -> ()

  (** Comment *)
  let comment : pos -> repr = fun _ -> ()

  (** Raw expression *)
  let expression : expression -> repr = fun _ -> ()

  type clause = pos * expression * repr list

  let if_ : pos -> clause -> elifs:clause list -> else_:repr list -> repr =
   fun _ _ ~elifs ~else_ ->
    ignore elifs;
    ignore else_;
    ()

  let act : pos -> label:expression -> repr list -> repr =
   fun _ ~label _ ->
    ignore label;
    ()

  let assign :
      pos ->
      (S.pos, expression) S.variable ->
      T.assignation_operator ->
      expression ->
      repr =
   fun _ _ _ _ -> ()
end

module Location = struct
  type repr = Instruction.repr
  type instruction = Instruction.repr

  let location : pos -> instruction list -> repr =
   fun _pos instructions ->
    List.fold_left instructions ~init:() ~f:(fun () instruction -> instruction)
end