diff options
author | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-12 16:42:25 +0200 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ansys.com> | 2014-06-12 16:42:25 +0200 |
commit | 68fef7a9612cf42ba42d9ca1cc2423556f66b461 (patch) | |
tree | fe0941eaf32cab6f6f463c2a72b7c0013c409040 /frontend/ast.ml | |
parent | cfe9934537d0ddf1a98b32237c06ddf81aed45b1 (diff) | |
download | scade-analyzer-68fef7a9612cf42ba42d9ca1cc2423556f66b461.tar.gz scade-analyzer-68fef7a9612cf42ba42d9ca1cc2423556f66b461.zip |
Working prototype for an interpret ! But very messy.
Diffstat (limited to 'frontend/ast.ml')
-rw-r--r-- | frontend/ast.ml | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/frontend/ast.ml b/frontend/ast.ml index b245119..50fa3f4 100644 --- a/frontend/ast.ml +++ b/frontend/ast.ml @@ -14,7 +14,6 @@ type typ = | AST_TINT | AST_TBOOL | AST_TREAL - | AST_TGROUP of typ list type unary_op = | AST_UPLUS @@ -56,20 +55,29 @@ type expr = | AST_binary_bool of bin_bool_op * (expr ext) * (expr ext) | AST_not of expr ext (* temporal primitives *) - | AST_pre of expr ext + | AST_pre of expr ext * id | AST_arrow of (expr ext) * (expr ext) (* other *) | AST_if of (expr ext) * (expr ext) * (expr ext) - | AST_instance of (id ext) * (expr ext list) - (* (TODO) and more : when, merge, activate instances, ... *) + | AST_instance of (id ext) * (expr ext list) * id -type eqn = +type var_def = bool * (id ext) * typ + +type automaton = id * state ext list * id list +and state = { + initial : bool; + name : id; + locals : var_def list; + body : eqn ext list; + until : transition list; +} +and transition = (expr ext) * (id ext) + +and eqn = | AST_assign of (id ext list) * (expr ext) | AST_guarantee of (id ext) * (expr ext) | AST_assume of (id ext) * (expr ext) - (* (TODO) and more : automaton, activate... *) - -type var_def = bool * (id ext) * typ + | AST_automaton of automaton type node_decl = { name : id; @@ -90,3 +98,4 @@ type toplevel = | AST_const_decl of const_decl ext type prog = toplevel list + |