BadVPN – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14  
15 # This is the grammar for all other grammar files that will work with the
16 # Lime LALR(1) Context-Free Grammar Parser Generator.
17 # You can read this to get an idea how things work, but this file is not
18 # actually used in the system. Rather, it's an implementation guide for the
19 # file "lime.bootstrap".
20  
21 %class lime_metaparser
22 %start grammar
23  
24 grammar
25 = {$$ = new lime();}
26 | grammar/$ pragma/p toklist/t stop {$$->pragma($p, $t);}
27 | grammar/$ rewrite/r stop {$r->update($$);}
28 .
29  
30 rewrite
31 = sym/s '=' rhs/r {$$ = new lime_rewrite($s); $$->add_rhs($r);}
32 | rewrite/$ '|' rhs/r {$$->add_rhs($r);}
33 .
34  
35 slot
36 = action/a {$$ = new lime_action($a, NULL);}
37 | action/a lambda/l {$$ = new lime_action($a, $l);}
38 | sym/s {$$ = new lime_glyph($s, NULL);}
39 | sym/s lambda/l {$$ = new lime_glyph($s, $l);}
40 | lit/l {$$ = new lime_glyph($l, NULL);}
41 .
42  
43 rhs
44 = {$$ = new lime_rhs();}
45 | rhs/$ slot/s {$$->add($s);}
46 .
47  
48 action = '{' code/$ '}' .
49  
50 toklist = {$$=array();}
51 | toklist/$ sym/s {$$[] = $s;}
52 | toklist/$ lit/l {$$[] = $l;}
53 .
54  
55 code = {}
56 | code/$ php/p {$$.=$p;}
57 | code/$ '{' code/c '}' {$$.='{'.$c.'}';}
58 .