SCM Repository
Annotation of /branches/vis12/doc/report/grammar-defs.tex
Parent Directory
|
Revision Log
Revision 1116 -
(view)
(download)
(as text)
Original Path: trunk/doc/report/grammar-defs.tex
1 : | jhr | 97 | %!TEX root = report.tex |
2 : | % | ||
3 : | % Macros for the various rules of the Diderot grammar. We collect the | ||
4 : | % grammer into these macros to ensure consistency between the collected | ||
5 : | % syntax and the body of the text. | ||
6 : | % | ||
7 : | \newcommand{\ProgramRULES}{ | ||
8 : | \begin{Rules}{Program} | ||
9 : | \RHS{\LISTONE{\nt{Declaration}}} | ||
10 : | \end{Rules}} | ||
11 : | \newcommand{\DeclarationRULES}{ | ||
12 : | \begin{Rules}{Declaration} | ||
13 : | \RHS{\nt{InputDecl}} | ||
14 : | \RHS{\nt{VarDecl}} | ||
15 : | jhr | 1116 | \RHS{\nt{StrandDecl}} |
16 : | jhr | 97 | \RHS{\nt{CoordinationDecl}} |
17 : | \end{Rules}} | ||
18 : | \newcommand{\InputDeclRULES}{ | ||
19 : | \begin{Rules}{InputDecl} | ||
20 : | \RHS{\kw{input} \nt{Type} \term{Id} \OPTGRP{\kw{=} \nt{Expr}} \kw{;}} | ||
21 : | \end{Rules}} | ||
22 : | jhr | 1116 | \newcommand{\StrandDeclRULES}{ |
23 : | \begin{Rules}{StrandDecl} | ||
24 : | \RHS{\kw{strand} \term{Id} \kw{(} \nt{Params} \kw{)} \kw{\{} \LISTGRP{\nt{StrandStateDecl}} \LISTONEGRP{\nt{StrandMethod}} \kw{\}}} | ||
25 : | jhr | 97 | \end{Rules}} |
26 : | \newcommand{\ParamsRULES}{ | ||
27 : | \begin{Rules}{Params} | ||
28 : | \RHS{\OPTGRP{\nt{Param} \LISTGRP{\kw{,} \nt{Param}}}} | ||
29 : | \end{Rules}} | ||
30 : | \newcommand{\ParamRULES}{ | ||
31 : | \begin{Rules}{Param} | ||
32 : | jhr | 101 | \RHS{\nt{ValueType} \term{Id}} |
33 : | jhr | 97 | \end{Rules}} |
34 : | jhr | 1116 | \newcommand{\StrandStateDeclRULES}{ |
35 : | \begin{Rules}{StrandStateDecl} | ||
36 : | jhr | 162 | \RHS{\OPT{\kw{output}} \nt{VarDecl}} |
37 : | \end{Rules}} | ||
38 : | jhr | 1116 | \newcommand{\StrandMethodRULES}{ |
39 : | \begin{Rules}{StrandMethod} | ||
40 : | jhr | 335 | \RHS{\nt{MethodId} \nt{Block}} |
41 : | jhr | 97 | \end{Rules}} |
42 : | jhr | 335 | \newcommand{\MethodIdRULES}{ |
43 : | \begin{Rules}{MethodId} | ||
44 : | \RHS{\kw{update}} | ||
45 : | \RHS{\kw{stabilize}} | ||
46 : | \RHS{\term{Id}} | ||
47 : | \end{Rules}} | ||
48 : | jhr | 97 | \newcommand{\BlockRULES}{ |
49 : | \begin{Rules}{Block} | ||
50 : | \RHS{\kw{\{} \LISTGRP{\nt{Stmt}} \kw{\}}} | ||
51 : | \end{Rules}} | ||
52 : | \newcommand{\StmtRULES}{ | ||
53 : | \begin{Rules}{Stmt} | ||
54 : | \RHS{\nt{Block}} | ||
55 : | \RHS{\nt{VarDecl}} | ||
56 : | \RHS{\kw{stabilize} \kw{;}} | ||
57 : | \RHS{\kw{die} \kw{;}} | ||
58 : | \RHS{\kw{new} \term{Id} \kw{(} \nt{Arguments} \kw{)} \kw{;}} | ||
59 : | \RHS{\term{Id} \kw{=} \nt{Expr} \kw{;}} | ||
60 : | \RHS{\kw{if} \kw{(} \nt{Expr} \kw{)} \nt{Stmt} \kw{else} \nt{Stmt}} | ||
61 : | \RHS{\kw{if} \kw{(} \nt{Expr} \kw{)} \nt{Stmt}} | ||
62 : | \end{Rules}} | ||
63 : | \newcommand{\VarDeclRULES}{ | ||
64 : | \begin{Rules}{VarDecl} | ||
65 : | \RHS{\nt{Type} \term{Id} \kw{=} \nt{Expr} \kw{;}} | ||
66 : | \end{Rules}} | ||
67 : | \newcommand{\TypeRULES}{ | ||
68 : | \begin{Rules}{Type} | ||
69 : | jhr | 101 | \RHS{\kw{image} \kw{(} \term{Int} \kw{)} \nt{Dimensions}} |
70 : | \RHS{\kw{field} \kw{\#} \term{Int} \kw{(} \term{Int} \kw{)} \nt{Dimensions}} | ||
71 : | \RHS{\kw{kernel} \kw{\#} \term{Int}} | ||
72 : | jhr | 1116 | \RHS{\nt{ValueType} \LISTGRP{\kw{\{} \term{Int} \kw{\}}}} |
73 : | jhr | 97 | \end{Rules}} |
74 : | jhr | 98 | \newcommand{\ValueTypeRULES}{ |
75 : | \begin{Rules}{ValueType} | ||
76 : | jhr | 1116 | \RHS{\kw{tensor} \nt{Dimensions}} |
77 : | jhr | 101 | \RHS{\kw{real}} |
78 : | jhr | 98 | \RHS{\kw{vec2}} |
79 : | \RHS{\kw{vec3}} | ||
80 : | \RHS{\kw{vec4}} | ||
81 : | jhr | 1116 | \RHS{\kw{bool}} |
82 : | \RHS{\kw{int}} | ||
83 : | \RHS{\kw{string}} | ||
84 : | jhr | 98 | \end{Rules}} |
85 : | \newcommand{\DimensionsRULES}{ | ||
86 : | \begin{Rules}{Dimensions} | ||
87 : | jhr | 1116 | \RHS{\kw{[} \OPTGRP{\term{Int} \LISTGRP{\kw{,} \term{Int}}} \kw{]}} |
88 : | jhr | 98 | \end{Rules}} |
89 : | jhr | 97 | \newcommand{\CoordinationDeclRULES}{ |
90 : | \begin{Rules}{CoordinationDecl} | ||
91 : | \RHS{\kw{initially} \nt{\GRP{\nt{Array} $\;|\;$ \nt{Collection}}} \kw{;}} | ||
92 : | \end{Rules}} | ||
93 : | \newcommand{\ArrayRULES}{ | ||
94 : | \begin{Rules}{Array} | ||
95 : | \RHS{\kw{[} \nt{Create} \kw{|} \nt{Iterations} \kw{]}} | ||
96 : | \end{Rules}} | ||
97 : | \newcommand{\CollectionRULES}{ | ||
98 : | \begin{Rules}{Collection} | ||
99 : | \RHS{\kw{\{} \nt{Create} \kw{|} \nt{Iterations} \kw{]}} | ||
100 : | \end{Rules}} | ||
101 : | \newcommand{\CreateRULES}{ | ||
102 : | \begin{Rules}{Create} | ||
103 : | \RHS{\term{Id} \kw{(} \nt{Arguments} \kw{)}} | ||
104 : | \end{Rules}} | ||
105 : | \newcommand{\IterationsRULES}{ | ||
106 : | \begin{Rules}{Iterations} | ||
107 : | \RHS{\nt{Iteration} \LISTONEGRP{\kw{,} \nt{Iteration}}} | ||
108 : | \end{Rules}} | ||
109 : | \newcommand{\IterationRULES}{ | ||
110 : | \begin{Rules}{Iteration} | ||
111 : | \RHS{\term{Id} \kw{in} \nt{Expr} \kw{..} \nt{Expr}} | ||
112 : | \end{Rules}} | ||
113 : | \newcommand{\ExprRULES}{ | ||
114 : | \begin{Rules}{Expr} | ||
115 : | jhr | 378 | \RHS{\nt{TestExpr} \OPTGRP{\kw{if} \nt{Expr} \kw{else} \nt{Expr}}} |
116 : | \end{Rules}} | ||
117 : | \newcommand{\TestExprRULES}{ | ||
118 : | \begin{Rules}{TestExpr} | ||
119 : | jhr | 97 | \RHS{\nt{AndExpr} \LISTGRP{\kw{||} \nt{AndExpr}}} |
120 : | \end{Rules}} | ||
121 : | \newcommand{\AndExprRULES}{ | ||
122 : | \begin{Rules}{AndExpr} | ||
123 : | \RHS{\nt{CmpExpr} \LISTGRP{\kw{\&\&} \nt{CmpExpr}}} | ||
124 : | \end{Rules}} | ||
125 : | \newcommand{\CmpExprRULES}{ | ||
126 : | jhr | 378 | \begin{Rules}{CmpExpr} |
127 : | jhr | 97 | \RHS{\nt{AddExpr} \LISTGRP{\nt{CmpOp} \nt{AddExpr}}} |
128 : | \end{Rules}} | ||
129 : | \newcommand{\AddExprRULES}{ | ||
130 : | \begin{Rules}{AddExpr} | ||
131 : | \RHS{\nt{MulExpr} \LISTGRP{\nt{AddOp} \nt{MulExpr}}} | ||
132 : | \end{Rules}} | ||
133 : | \newcommand{\MulExprRULES}{ | ||
134 : | \begin{Rules}{MulExpr} | ||
135 : | jhr | 1116 | \RHS{\nt{PowerExpr} \LISTGRP{\nt{MulOp} \nt{PowerExpr}}} |
136 : | jhr | 97 | \end{Rules}} |
137 : | jhr | 1116 | \newcommand{\PowerExprRULES}{ |
138 : | \begin{Rules}{PowerExpr} | ||
139 : | \RHS{\nt{ProbeExpr} \LISTGRP{\kw{\^} \nt{ProbeExpr}}} | ||
140 : | \end{Rules}} | ||
141 : | jhr | 386 | \newcommand{\ProbeExprRULES}{ |
142 : | \begin{Rules}{ProbeExpr} | ||
143 : | \RHS{\nt{PrefixExpr} \OPTGRP{\kw{@} \nt{AtomExpr}}} | ||
144 : | \end{Rules}} | ||
145 : | jhr | 97 | \newcommand{\PrefixExprRULES}{ |
146 : | \begin{Rules}{PrefixExpr} | ||
147 : | jhr | 1116 | \RHS{\nt{SuffixExpr}} |
148 : | jhr | 97 | \RHS{\kw{-} \nt{PrefixExpr}} |
149 : | \RHS{\kw{!} \nt{PrefixExpr}} | ||
150 : | \RHS{\kw{D} \nt{PrefixExpr}} | ||
151 : | \end{Rules}} | ||
152 : | jhr | 1116 | \newcommand{\SuffixExprRULES}{ |
153 : | \begin{Rules}{SuffixExpr} | ||
154 : | \RHS{\nt{DerivExpr} \LIST{\nt{Suffix}}} | ||
155 : | jhr | 97 | \end{Rules}} |
156 : | jhr | 1116 | \newcommand{\SuffixRULES}{ |
157 : | \begin{Rules}{Suffix} | ||
158 : | \RHS{\kw{(} \nt{Arguments} \kw{)}} | ||
159 : | \RHS{\kw{[} \nt{Index} \LISTGRP{\kw{,} \nt{Index}} \kw{]}} | ||
160 : | \RHS{\kw{\{} Expr \kw{\}}} | ||
161 : | \end{Rules}} | ||
162 : | jhr | 386 | \newcommand{\IndexRULES}{ |
163 : | \begin{Rules}{Index} | ||
164 : | \RHS{\kw{:}} | ||
165 : | \RHS{\nt{Expr}} | ||
166 : | \end{Rules}} | ||
167 : | jhr | 1116 | \newcommand{\DerivExprRULES}{ |
168 : | \begin{Rules}{DerivExpr} | ||
169 : | \RHS{\nt{AtomExpr}} | ||
170 : | \RHS{\nt{$\mathbf{\nabla}$} \nt{AtomExpr}} | ||
171 : | \RHS{\nt{$\mathbf{\nabla\otimes}$} \nt{DerivExpr}} | ||
172 : | \RHS{\nt{$\mathbf{\nabla\times}$} \nt{DerivExpr}} | ||
173 : | \RHS{\nt{$\mathbf{\nabla\bullet}$} \nt{DerivExpr}} | ||
174 : | \end{Rules}} | ||
175 : | \newcommand{\AtomExprRULES}{ | ||
176 : | \begin{Rules}{AtomExpr} | ||
177 : | \RHS{\term{Id}} | ||
178 : | \RHS{\kw{identity} \kw{[} \term{Int} \kw{]}} | ||
179 : | \RHS{\kw{zeros} \nt{Dimensions}} | ||
180 : | jhr | 98 | \RHS{\kw{real} \kw{(} \nt{Expr} \kw{)}} |
181 : | jhr | 1116 | \RHS{\kw{(} \nt{Expr} \LISTGRP{\kw{,} \nt{Expr}} \kw{)}} |
182 : | \RHS{\kw{\{} \nt{Expr} \LISTGRP{\kw{,} \nt{Expr}} \kw{\}}} | ||
183 : | jhr | 98 | \RHS{\kw{[} \nt{Expr} \LISTGRP{\kw{,} \nt{Expr}} \kw{]}} |
184 : | jhr | 97 | \RHS{\term{Int}} |
185 : | \RHS{\term{Float}} | ||
186 : | \RHS{\term{String}} | ||
187 : | jhr | 100 | \RHS{\kw{|} \nt{Expr} \kw{|}} |
188 : | jhr | 97 | \end{Rules}} |
189 : | \newcommand{\ArgumentsRULES}{ | ||
190 : | \begin{Rules}{Arguments} | ||
191 : | \RHS{\OPTGRP{\nt{Expr} \LISTGRP{\kw{,} \nt{Expr}}}} | ||
192 : | \end{Rules}} | ||
193 : | \newcommand{\CmpOpRULES}{ | ||
194 : | \begin{Rules}{CmpOp} | ||
195 : | \RHS{\kw{<}} | ||
196 : | \RHS{\kw{<=}} | ||
197 : | \RHS{\kw{==}} | ||
198 : | \RHS{\kw{!=}} | ||
199 : | \RHS{\kw{>=}} | ||
200 : | \RHS{\kw{>}} | ||
201 : | \end{Rules}} | ||
202 : | \newcommand{\AddOpRULES}{ | ||
203 : | \begin{Rules}{AddOp} | ||
204 : | \RHS{\kw{+}} | ||
205 : | \RHS{\kw{-}} | ||
206 : | \end{Rules}} | ||
207 : | \newcommand{\MulOpRULES}{ | ||
208 : | \begin{Rules}{MulOp} | ||
209 : | \RHS{\kw{*}} | ||
210 : | \RHS{\kw{/}} | ||
211 : | jhr | 1116 | \RHS{$\mathbf{\circledast}$} |
212 : | \RHS{$\mathbf{\otimes}$} | ||
213 : | \RHS{$\mathbf{\bullet}$} | ||
214 : | jhr | 97 | \end{Rules}} |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |