13 // output "s2:{s2:{s0 s0} x}";
14 // output "s2:{s0 x}";
24 output "1:{{a b} {c}}";
27 ids ::= id (" " ids &~ id ~[]*) => "1"
28 | id ( ids &~ id ~[]*) => "2"
36 output "2:{{a} 1:{{b} {c}}}";
37 output "1:{{a b} {c}}";
40 ids ::= id " " ids => "1"
73 output "xbx:{abab:{a b}}";
77 b ::= [ab][ab] => abab
83 output "ac:{{2 1 2 1}}";
84 //output "a:{{2 1 2 1}}";
85 //output "c:{{c:{1 1} c:{1 1}}}";
98 c ::= (x "2" x "1" => "c")*
104 output "bam:{a bam:{a bam:{a x:{x}}}}";
114 output "s2:{b0 a:{a:{epsilon}}}";
115 output "b:{a:{a:{epsilon}} epsilon}";
126 output "q:{a:{s1:{epsilon}}}";
130 x ::= () => "epsilon"
136 output "s1:{a2:{a2:{a0 b0} b0}}";
139 a ::= "a" a b => "a2"
147 output "s3:{s3:{epsilon a0 epsilon epsilon} epsilon epsilon epsilon}";
148 output "s3:{s3:{epsilon epsilon epsilon epsilon} a0 epsilon epsilon}";
149 output "s3:{s3:{epsilon epsilon a0 epsilon} epsilon epsilon epsilon}";
150 output "s3:{s3:{epsilon epsilon epsilon a0} epsilon epsilon epsilon}";
151 output "s3:{epsilon epsilon a0 a0}";
152 output "s3:{s3:{s3:{epsilon epsilon epsilon epsilon} epsilon epsilon epsilon} epsilon epsilon epsilon}";
153 output "s3:{s3:{epsilon epsilon epsilon epsilon} epsilon epsilon a0}";
154 output "s3:{s3:{epsilon epsilon epsilon epsilon} epsilon a0 epsilon}";
155 output "s3:{epsilon a0 epsilon a0}";
156 output "s3:{epsilon a0 a0 epsilon}";
158 s ::= "a" s a a a => "s3"
166 output "poo:{poo:{poox poox} poox}";
167 output "poo:{poox poo:{poox poox}}";
168 s ::= s s "a" => "poo"
174 output "s:{aa:{aa:{a b} b}}";
176 a ::= "a" a b => "aa"
183 output "sx:{b aa:{aa:{b b} b}}";
184 s ::= b d "a" "b" => "sx"
185 s ::= "a" d "a" d => "sy"
186 d ::= "a" a b => "aa"
187 a ::= "a" b b => "aa"
194 output "+:{{a} *:{{b} {c}}}";
206 output "plus:{stringify:{{a}} minus:{stringify:{{b}} times:{stringify:{{d}} stringify:{{c}}}}}";
207 output "times:{plus:{stringify:{{a}} minus:{stringify:{{b}} stringify:{{d}}}} stringify:{{c}}}";
208 output "plus:{stringify:{{a}} times:{minus:{stringify:{{b}} stringify:{{d}}} stringify:{{c}}}}";
209 output "times:{minus:{plus:{stringify:{{a}} stringify:{{b}}} stringify:{{d}}} stringify:{{c}}}";
210 output "minus:{plus:{stringify:{{a}} stringify:{{b}}} times:{stringify:{{d}} stringify:{{c}}}}";
213 s ::= l "=" q => "assign"
216 | l "=" q => "assign"
221 id ::= idl++ => "stringify"
227 // output "times:{stringify:{{a}} times:{stringify:{{b}} stringify:{{c}}}}";
230 // s ::= l "=" r => "assign"
233 // | l "=" r => "assign"
234 // | r "+" r => "plus"
235 // | (r) "*" r => "times"
238 // id ::= idl++ => "stringify"
244 output "plus:{stringify:{{a}} times:{stringify:{{b}} stringify:{{c}}}}";
247 s ::= l "=" r => "assign"
250 | l "=" r => "assign"
255 id ::= idl++ => "stringify"
261 output "{q:{{a a}} q:{{b b}}}";
288 // output "smt:{while:{>:{{x} {0}} while:{>:{{y} {0}} sbb:{{f o o} {b a r}}}} while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}}}";
291 //outdent !::= " " outdent " "
294 //w !::= " " | "\n" | "\r"
300 //s ::= ws statement ws statement ws => smt
302 //block ::= "\n" indent blockBody
303 // &~ "\n" outdent ~[\ ] ~[]*
305 //blockBody ::= statement
306 // > statement ws blockBody => "sbb"
309 // | ^"while" expr block /ws
313 // | expr ^">" expr /ws
316 //call ::= expr "()" /ws
320 //ident ::= [a-z]++ &~ keyword
321 //keyword ::= "if" | "then" | "else" | "while"
333 q ::= [a-z] [a-z] [a-z] => a3
341 s ::= [a-z] [a-z] [a-z] " "* => s