summaryrefslogtreecommitdiff
path: root/Source/Forro/Ast.fs
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Forro/Ast.fs')
-rw-r--r--Source/Forro/Ast.fs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/Forro/Ast.fs b/Source/Forro/Ast.fs
index fa4db8ec..6c7ba65c 100644
--- a/Source/Forro/Ast.fs
+++ b/Source/Forro/Ast.fs
@@ -1,10 +1,14 @@
-namespace Forro
+module Forro
type Field = Head | Tail | Valid
type Variable = Var of string
-type Operator = Eq | Neq | Plus | Minus | Times | Less | AtMost | And | Or
+let VarName v =
+ match v with Var(x) -> x
+
+type Operator = Eq | Neq | Plus | Minus | Times
+ | Less | AtMost | And | Or
type Expression =
| Constant of int
@@ -15,10 +19,7 @@ type Expression =
| Select of Expression * Field
| Old of Expression
-type StmtList =
- Block of Statement list
-
-and Statement =
+type Statement =
| Assign of Variable * Expression
| Update of Expression * Field * Expression
| Alloc of Variable * Expression * Expression
@@ -27,6 +28,9 @@ and Statement =
| CallStmt of Variable list * string * Expression list
| Assert of Expression
+and StmtList =
+ Block of Statement list
+
type Procedure =
Proc of string * Variable list * Variable list * Expression * Expression * StmtList