|
|
1.1 root 1: /* @(#)r.g 1.1 (Berkeley) 12/15/82 */
2: %{
3: extern int transfer;
4: extern int indent;
5: %}
6:
7: %term IF ELSE FOR WHILE BREAK NEXT
8: %term DIGITS DO
9: %term GOK DEFINE INCLUDE
10: %term REPEAT UNTIL
11: %term RETURN
12: %term SWITCH CASE DEFAULT
13: %%
14:
15: statl : statl stat
16: |
17: ;
18: stat : if stat ={ indent--; outcont($1); }
19: | ifelse stat ={ indent--; outcont($1+1); }
20: | switch fullcase '}' ={ endsw($1, $2); }
21: | while stat ={ whilestat($1); }
22: | for stat ={ forstat($1); }
23: | repeat stat UNTIL ={ untils($1,1); }
24: | repeat stat ={ untils($1,0); }
25: | BREAK ={ breakcode(); }
26: | NEXT ={ nextcode(); }
27: | do stat ={ dostat($1); }
28: | GOK ={ gokcode($1); }
29: | RETURN ={ retcode(); }
30: | ';'
31: | '{' statl '}'
32: | label stat
33: | error ={ errcode(); yyclearin; }
34: ;
35: switch : sw '{'
36: ;
37: sw : SWITCH ={ swcode(); }
38: ;
39: fullcase: caselist ={ $$ = 0; }
40: | caselist defpart ={ $$ = 1; }
41: ;
42: caselist: casepart
43: | caselist casepart
44: ;
45: defpart : default statl
46: ;
47: default : DEFAULT ={ getdefault(); }
48: ;
49: casepart: case statl
50: ;
51: case : CASE ={ getcase(); }
52: ;
53: label : DIGITS ={ transfer = 0; outcode($1); }
54: ;
55: if : IF ={ ifcode(); }
56: ;
57: ifelse : if stat ELSE ={ elsecode($1); }
58: ;
59: while : WHILE ={ whilecode(); }
60: ;
61: for : FOR ={ forcode(); }
62: ;
63: repeat : REPEAT ={ repcode(); }
64: ;
65: do : DO ={ docode(); }
66: ;
67: %%
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.