diff options
Diffstat (limited to 'lib/syntax/tree.ml')
-rw-r--r-- | lib/syntax/tree.ml | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/syntax/tree.ml b/lib/syntax/tree.ml index 6f6e7f2..b7d9d15 100644 --- a/lib/syntax/tree.ml +++ b/lib/syntax/tree.ml @@ -2,11 +2,13 @@ open StdLabels let identifier = "tree" let description = "Build the AST" +let is_global = false let active = ref true type context = unit let initialize = Fun.id +let finalize () = [] module Ast = struct type 'a literal = 'a T.literal = Text of string | Expression of 'a @@ -72,28 +74,27 @@ end module Instruction : S.Instruction - with type expression = Expression.t' - and type t' = S.pos Ast.statement = struct + with type t' = S.pos Ast.statement + and type expression = Expression.t' = struct type t = S.pos Ast.statement type t' = t + type expression = Expression.t' let v : t -> t' = fun t -> t - type expression = Expression.t' - - let call : S.pos -> T.keywords -> expression list -> t = + let call : S.pos -> T.keywords -> Expression.t' list -> t = fun pos name args -> Ast.Call (pos, name, args) let location : S.pos -> string -> t = fun loc label -> Ast.Location (loc, label) let comment : S.pos -> t = fun pos -> Ast.Comment pos - let expression : expression -> t = fun expr -> Ast.Expression expr + let expression : Expression.t' -> t = fun expr -> Ast.Expression expr let if_ : S.pos -> - (expression, t) S.clause -> - elifs:(expression, t) S.clause list -> + (Expression.t', t) S.clause -> + elifs:(Expression.t', t) S.clause list -> else_:(S.pos * t list) option -> t = fun pos predicate ~elifs ~else_ -> @@ -105,14 +106,14 @@ module Instruction : Ast.If { loc = pos; then_ = clause predicate; elifs; else_ } - let act : S.pos -> label:expression -> t list -> t = + let act : S.pos -> label:Expression.t' -> t list -> t = fun pos ~label statements -> Ast.Act { loc = pos; label; statements } let assign : S.pos -> - (S.pos, expression) S.variable -> + (S.pos, Expression.t') S.variable -> T.assignation_operator -> - expression -> + Expression.t' -> t = fun pos_loc { pos; name; index } op expr -> (*let index = Option.map (fun i -> fst @@ Expression.observe (i [])) index*) @@ -120,11 +121,10 @@ module Instruction : end module Location = struct - type instruction = Instruction.t' type t = S.pos * S.pos Ast.statement list let v _ = [] - let location : unit -> S.pos -> instruction list -> t = + let location : unit -> S.pos -> Instruction.t' list -> t = fun () pos block -> (pos, block) end |