-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.hs
More file actions
32 lines (29 loc) · 858 Bytes
/
Model.hs
File metadata and controls
32 lines (29 loc) · 858 Bytes
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
module Model where
-- Exercise 1
-- Straight from the Lexer.x
data Token = TArrow | TDot | TComma | TGo | TTake | TMark | TNothing | TTurn | TCase | TOf | TEnd |
TLeft | TRight | TFront | TSemicolon |
TEmpty | TLambda | TDebris | TAsteroid | TBoundary | TUnderscore |
TIdent String deriving (Eq,Show)
-- Exercise 2
data Program = Program [Rule] deriving (Eq,Show)
data Rule = Rule String Cmds deriving (Eq,Show)
data Cmds = Cmds [Cmd] deriving (Eq,Show,Ord)
data Cmd = Go
| Take
| Mark
| Nothin
| Turn Dir
| Case Dir Alts
| Ident String deriving (Eq,Show,Ord)
data Dir = Lef
| Righ
| Fron deriving (Eq,Show,Ord)
data Alts = Alts [Alt] deriving (Eq,Show,Ord)
data Alt = Alt Contents Cmds deriving (Eq,Show,Ord)
data Contents = Empty
| Lambda
| Debris
| Asteroid
| Boundary
| Underscore deriving (Eq,Show,Ord)