aboutsummaryrefslogtreecommitdiff
path: root/Sil/Parse.dcl
blob: 441bf9ec3cdc12d1d5eaa1e9a53bd2c7fa0cd072 (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
definition module Sil.Parse

from StdOverloaded import class ==, class toString

from Data.Error import :: MaybeError

from Sil.Error import :: Error
from Sil.Syntax import :: Program, :: Literal
from Sil.Util.Parser import class name

:: Token
	= TParenOpen          //* (
	| TParenClose         //* )
	| TBraceOpen          //* {
	| TBraceClose         //* }
	| TComma              //* ,
	| TSemicolon          //* ;
	| TField String       //* . and field name
	| TAssign             //* :=
	| TTilde              //* ~
	| TExclamation        //* !
	| TPlus               //* +
	| TMinus              //* -
	| TStar               //* *
	| TSlash              //* /
	| TPercent            //* %
	| TDoubleEquals       //* ==
	| TDoubleBar          //* ||
	| TDoubleAmpersand    //* &&
	| TLit Literal        //* True; False; integers
	| TIf                 //* if
	| TElse               //* else
	| TWhile              //* while
	| TReturn             //* return
	| TMachineCode String //* |~ machine code
	| TName String        //* a string

instance == Token
instance toString Token
instance name Token

tokenise :: [Char] -> MaybeError Error [Token]

parse :: ([Token] -> MaybeError Error Program)