-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrammars.tex
More file actions
231 lines (207 loc) · 10 KB
/
grammars.tex
File metadata and controls
231 lines (207 loc) · 10 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
% !TEX root=main.tex
%% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newmacro{G-Language}{
\begin{grammar}
Expressions
& e &::= & \lambda x:\tau.\ e & – abstraction \\
& &\mid& e_1\ e_2 & – application \\
& &\mid& x & – variable \\
& &\mid& c & – constant \\
\addlinespace
& &\mid& e_1 \star e_2 & – operation \\
& &\mid& \If{e_1}{e_2}{e_3} & – branch \\
& &\mid& \tuple{e_1, e_2} & – pair \\
& &\mid& \Fst e & – first projection \\
& &\mid& \Snd e & – second projection \\
& &\mid& \unit & – unit \\
\addlinespace
& &\mid& \Ref e & – reference \\
& &\mid& !e & – dereference \\
& &\mid& e_1 := e_2 & – assignment \\
% & &\mid& e_1; e_2 & – sequence \\
& &\mid& l & – location \\
\addlinespace
& &\mid& p & – pretask \\
\addlinespace
Constants
& c &::= & B & – boolean \\
& &\mid& I & – integer \\
& &\mid& S & – string
\end{grammar}
}
\newmacro{G-Language-Compact}{
\begin{grammar}
Expressions
& e & ::= & \lambda x:\tau.\ e \Mid e_1\ e_2 & – abstraction, application \\
& & \mid & x \Mid c \Mid e_1 \star e_2 & – variable, constant, operation \\
& & \mid & \If{e_1}{e_2}{e_3} \Mid \unit & – branch, unit \\
& & \mid & \tuple{e_1, e_2} \Mid \Fst e \Mid \Snd e & – pair, projections \\
& & \mid & \Ref e \Mid !e \Mid e_1 := e_2 \Mid l & – references, location \\
& & \mid & p & – pretask \\
Constants
& c & ::= & B \Mid I \Mid S & – boolean, integer, string
\end{grammar}
}
\newmacro{G-Language-Minimal}{
\begin{grammar*}
e ::= & & Expressions \\
\mid & \lambda x:\tau.\ e \Mid e_1\ e_2 & – abstraction, application \\
\mid & x \Mid c \Mid e_1 \star e_2 & – variable, constant, operation \\
\mid & \If{e_1}{e_2}{e_3} \Mid \unit & – branch, unit \\
\mid & \tuple{e_1, e_2} \Mid \Fst e \Mid \Snd e & – pair, projections \\
\mid & \Ref e \Mid !e \Mid e_1 := e_2 \Mid l & – references, location \\
\mid & p & – pretask \\
c ::= & & Constants \\
\mid & B \Mid I \Mid S & – boolean, integer, string
\end{grammar*}
}
\newmacro{G-Pretasks}{
\begin{grammar}
Pretasks
& p &::= & \Edit e & – valued editor \\
& &\mid& \Enter \tau & – unvalued editor \\
& &\mid& \Update e & – shared editor \\
\addlinespace
& &\mid& e_1 \Then e_2 & – step \\
& &\mid& e_1 \Next e_2 & – user step \\
\addlinespace
& &\mid& e_1 \And e_2 & – composition \\
\addlinespace
& &\mid& e_1 \Or e_2 & – choice \\
& &\mid& e_1 \Xor e_2 & – user choice \\
\addlinespace
& &\mid& u \At e & – appoint \\
& &\mid& \Fail & – fail task
\end{grammar}
}
\newmacro{G-Pretasks-Compact}{
\begin{grammar}
Pretasks
& p & ::= & \Edit e \Mid \Enter \tau \Mid \Update e & – editors: valued, unvalued, shared \\
& & \mid & e_1 \Then e_2 \Mid e_1 \Next e_2 & – steps: internal, external \\
& & \mid & \Fail \Mid e_1 \And e_2 & – fail, combination \\
& & \mid & e_1 \Or e_2 \Mid e_1 \Xor e_2 & – choice: internal, external \\
\end{grammar}
}
\newmacro{G-Pretasks-Minimal}{
\begin{grammar*}
p ::= & & Pretasks \\
\mid & \Edit e \Mid \Enter \tau \Mid \Update e & – editors: valued, unvalued, shared \\
\mid & e_1 \Then e_2 \Mid e_1 \Next e_2 & – steps: internal, external \\
\mid & \Fail \Mid e_1 \And e_2 & – fail, combination \\
\mid & e_1 \Or e_2 \Mid e_1 \Xor e_2 & – choice: internal, external \\
\end{grammar*}
}
\newmacro{G-Types}{
\begin{grammar}
Types
& \tau &::= & \tau_1 \to \tau_2 & – function type \\
& &\mid& \tau_1 \times \tau_2 & – product type \\
& &\mid& \Unit & – unit type \\
& &\mid& \Reference \tau & – reference type \\
& &\mid& \Task \tau & – task type \\
& &\mid& \beta & – basic type \\
% & &\mid& \alpha & – universal type \\
Basic types
&\beta &::= & \Bool & – boolean type \\
& &\mid& \Int & – integer type \\
& &\mid& \String & – string type \\
\end{grammar}
}
\newmacro{G-Types-Compact}{
\begin{grammar}
Types
& \tau & ::= & \tau_1 \to \tau_2 \Mid \tau_1 \times \tau_2 \Mid \beta & – function, product, basic \\
& & \mid & \Unit \Mid \Reference \tau \Mid \Task \tau & – unit, reference, task \\
Basic types
& \beta & ::= & \Bool \Mid \Int \Mid \String & – boolean, integer, string
\end{grammar}
}
\newmacro{G-Types-Minimal}{
\begin{grammar*}
\tau ::= & & Types \\
\mid & \tau_1 \to \tau_2 \Mid \tau_1 \times \tau_2 \Mid \beta & – function, product, basic \\
\mid & \Unit \Mid \Reference \tau \Mid \Task \tau & – unit, reference, task \\
\beta ::= & & Basic types \\
\mid & \Bool \Mid \Int \Mid \String & – boolean, integer, string
\end{grammar*}
}
\newmacro{G-Values}{
\begin{grammar}
Values
& v &::= & \lambda x:\tau.\ e & – abstraction \\
& &\mid& \tuple{v_1, v_2} & – pair value \\
& &\mid& \unit & – unit \\
& &\mid& c & – constant \\
& &\mid& l & – location \\
& &\mid& t & – task \\
Tasks
& t &::= & \Edit v & – valued editor \\
& &\mid& \Enter \tau & – unvalued editor \\
& &\mid& \Update l & – shared editor \\
& &\mid& \Fail & – fail task \\
& &\mid& t_1 \Then e_2 & – step \\
& &\mid& t_1 \Next e_2 & – user step \\
& &\mid& t_1 \And t_2 & – composition \\
& &\mid& t_1 \Or t_2 & – choice \\
& &\mid& t_1 \Xor t_2 & – user choice
\end{grammar}
}
\newmacro{G-Values-Compact}{
\begin{grammar}
Values
& v & ::= & \lambda x:\tau.\ e \Mid \tuple{v_1, v_2} \Mid \unit & – abstraction, pair, unit \\
& & \mid & c \Mid l \Mid t & – constant, location, task \\
Tasks
& t & ::= & \Edit v \Mid \Enter \tau \Mid \Update l & – editors \\
& & \mid & t_1 \Then e_2 \Mid t_1 \Next e_2 & – steps \\
& & \mid & \Fail \Mid t_1 \And t_2 & – fail, combination \\
& & \mid & t_1 \Or t_2 \Mid e_1 \Xor e_2 & – choices \\
\end{grammar}
}
\newmacro{G-Values-Minimal}{
\begin{grammar*}
v ::= & & Values \\
\mid& \lambda x:\tau.\ e \Mid \tuple{v_1, v_2} \Mid \unit & – abstraction, pair, unit \\
\mid& c \Mid l \Mid t & – constant, location, task \\
t ::= & & Tasks \\
\mid& \Edit v \Mid \Enter \tau \Mid \Update l & – editors \\
\mid& t_1 \Then e_2 \Mid t_1 \Next e_2 & – steps \\
\mid& \Fail \Mid t_1 \And t_2 & – fail, combination \\
\mid& t_1 \Or t_2 \Mid e_1 \Xor e_2 & – choices \\
\end{grammar*}
}
\newmacro{G-Inputs}{
\begin{grammar}
Inputs
& i & ::=& a & – action \\
& &\mid& \First i & – pass to first \\
& &\mid& \Second i & – pass to second \\
Actions
& a & ::=& v & – change editor to value \\
& &\mid& \Continue & – continue with next task \\
& &\mid& \Pick & – pick route \\
Routes
& r & ::=& \Left & – go left \\
& &\mid& \Right & – go right \\
\end{grammar}
}
\newmacro{G-Inputs-Compact}{
\begin{grammar}
Inputs
& i & ::= & a \Mid \First i \Mid \Second i & – action, pass to first, pass to second \\
Actions
& a & ::= & v \Mid \Continue \Mid \Left \Mid \Right & – change, continue, go left, go right
\end{grammar}
}
\newmacro{G-Inputs-Minimal}{
\begin{grammar*}
%j ::= & & Maybe Appointed Inputs\\
%\mid & u\At i \Mid i & – assigned input, input\\
i ::= & & Inputs \\
\mid & a \Mid \First i \Mid \Second i & – action, pass to first, pass to second \\
a ::= & & Actions \\
\mid & v \Mid \Continue & – change, continue\\
\mid & \Left \Mid \Right & – go left, go right
\end{grammar*}
}