blob: d6662ef7a196b478fdba36758bc7824090756964 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
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
| MachineStm String
:: Application
= Name Name
| Literal Literal
| App Name [Application]
| BuiltinApp Op1 Application
| BuiltinApp2 Application Op2 Application
:: Op1
= Neg //* ~
:: Op2
= Add //* +
| Sub //* -
| Mul //* *
| Div //* /
| Rem //* %
:: Type
= TBool
| TInt
| TVoid
:: Literal
= BLit Bool
| ILit Int
:: Name :== String
|