From 9f95fa78463d7e6b047485bdce28f1a970a45fd2 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 17 Jul 2017 21:48:37 +0000 Subject: Initial commit --- Sil/Syntax.dcl | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Sil/Syntax.dcl (limited to 'Sil/Syntax.dcl') diff --git a/Sil/Syntax.dcl b/Sil/Syntax.dcl new file mode 100644 index 0000000..01b7ff6 --- /dev/null +++ b/Sil/Syntax.dcl @@ -0,0 +1,52 @@ +definition module Sil.Syntax + +from Data.Maybe import :: Maybe + +:: Program = + { p_funs :: [Function] + } + +:: Function = + { f_type :: Type + , f_name :: Name + , f_args :: [Arg] + , f_code :: CodeBlock + } + +:: CodeBlock = + { cb_init :: [Initialisation] + , cb_content :: [Statement] + } + +:: Arg = + { arg_type :: Type + , arg_name :: Name + } + +:: Initialisation = + { init_type :: Type + , init_name :: Name + } + +:: Statement + = Declaration Name Application + | Application Application + | Return (Maybe Application) + | If Application CodeBlock (Maybe CodeBlock) + | While Application CodeBlock + +:: Application + = Name Name + | Literal Literal + | App Name [Application] + +:: Type + = TBool + | TInt + | TVoid + +:: Literal + = BLit Bool + | ILit Int + +:: Name :== String -- cgit v1.2.3