diff options
author | Chimrod <> | 2023-10-03 15:10:26 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-15 19:04:36 +0200 |
commit | 49f69c1ab4d3d8716f30d7bd36a66a4241e16d33 (patch) | |
tree | 13ef2d7577b725329eb89828f81a3f27174cef17 /lib/syntax/dead_end.ml | |
parent | 8ec89159f83b2c65995555f2c1a65e8ded950242 (diff) |
New analyzer for the dead end
Diffstat (limited to 'lib/syntax/dead_end.ml')
-rw-r--r-- | lib/syntax/dead_end.ml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/syntax/dead_end.ml b/lib/syntax/dead_end.ml new file mode 100644 index 0000000..78eadda --- /dev/null +++ b/lib/syntax/dead_end.ml @@ -0,0 +1,49 @@ +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 repr = unit + type expression = Expression.repr + type variable = Expression.variable + + (** 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 -> 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 |