From 9b2ab3b80a0c816862b8b6c90e64050b8369a51e Mon Sep 17 00:00:00 2001 From: rustanleino Date: Wed, 17 Nov 2010 17:31:39 +0000 Subject: Forro: revised syntax (this version used in Boogie tutorial at SBMF 2010) --- Source/Forro/Ast.fs | 16 ++++++++++------ Source/Forro/Forro.fsproj | 1 + Source/Forro/Lexer.fsl | 6 +++++- Source/Forro/Main.fs | 9 +++++++-- Source/Forro/Parser.fsy | 33 ++++++++++++++++++++------------- Source/Forro/Printer.fs | 29 +++++++++++++---------------- Source/Forro/Resolver.fs | 3 --- Source/Forro/Translator.fs | 22 ++++++++++++---------- 8 files changed, 68 insertions(+), 51 deletions(-) (limited to 'Source/Forro') 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 diff --git a/Source/Forro/Forro.fsproj b/Source/Forro/Forro.fsproj index 531264b3..8f6fc223 100644 --- a/Source/Forro/Forro.fsproj +++ b/Source/Forro/Forro.fsproj @@ -71,6 +71,7 @@ +