* add p cc
[mascara-docs.git] / compilers / pcc / pcc-1.0.0 / f77 / fcom / gram.io
blob469214c7f0b93622d3f59649d170ec23c1df3d39
1 /* Input/Output Statements */
3 io: io1
4 { endio(); }
7 io1: iofmove ioctl
8 | iofmove unpar_fexpr
9 { ioclause(IOSUNIT, $2); endioctl(); }
10 | iofctl ioctl
11 | read ioctl
12 { doio(NULL); }
13 | read ioctl inlist
14 { doio($3); }
15 | read infmt SCOMMA inlist
16 { doio($4); }
17 | read ioctl SCOMMA inlist
18 { doio($4); }
19 | write ioctl
20 { doio(NULL); }
21 | write ioctl outlist
22 { doio($3); }
23 | print
24 { doio(NULL); }
25 | print SCOMMA outlist
26 { doio($3); }
29 iofmove: fmkwd end_spec in_ioctl
32 fmkwd: SBACKSPACE
33 { iostmt = IOREWIND; }
34 | SREWIND
35 { iostmt = IOREWIND; }
36 | SENDFILE
37 { iostmt = IOENDFILE; }
40 iofctl: ctlkwd end_spec in_ioctl
43 ctlkwd: SINQUIRE
44 { iostmt = IOINQUIRE; }
45 | SOPEN
46 { iostmt = IOOPEN; }
47 | SCLOSE
48 { iostmt = IOCLOSE; }
51 infmt: unpar_fexpr
53 ioclause(IOSUNIT, NULL);
54 ioclause(IOSFMT, $1);
55 endioctl();
57 | SSTAR
59 ioclause(IOSUNIT, NULL);
60 ioclause(IOSFMT, NULL);
61 endioctl();
65 ioctl: SLPAR fexpr SRPAR
66 { ioclause(IOSUNIT, $2); endioctl(); }
67 | SLPAR ctllist SRPAR
68 { endioctl(); }
71 ctllist: ioclause SCOMMA ioclause
72 | ctllist SCOMMA ioclause
75 ioclause: fexpr
76 { ioclause(IOSPOSITIONAL, $1); }
77 | SSTAR
78 { ioclause(IOSPOSITIONAL, NULL); }
79 | nameeq expr
80 { ioclause($1, $2); }
81 | nameeq SSTAR
82 { ioclause($1, NULL); }
85 nameeq: SNAMEEQ
86 { $$ = iocname(); }
89 read: SREAD end_spec in_ioctl
90 { iostmt = IOREAD; }
93 write: SWRITE end_spec in_ioctl
94 { iostmt = IOWRITE; }
97 print: SPRINT end_spec fexpr in_ioctl
99 iostmt = IOWRITE;
100 ioclause(IOSUNIT, NULL);
101 ioclause(IOSFMT, $3);
102 endioctl();
104 | SPRINT end_spec SSTAR in_ioctl
106 iostmt = IOWRITE;
107 ioclause(IOSUNIT, NULL);
108 ioclause(IOSFMT, NULL);
109 endioctl();
113 inlist: inelt
114 { $$ = mkchain($1,0); }
115 | inlist SCOMMA inelt
116 { $$ = hookup($1, mkchain($3,0)); }
119 inelt: lhs
120 | SLPAR inlist SCOMMA dospec SRPAR
121 { $$ = mkiodo($4,$2); }
124 outlist: uexpr
125 { $$ = mkchain($1, 0); }
126 | other
127 { $$ = mkchain($1, 0); }
128 | out2
131 out2: uexpr SCOMMA uexpr
132 { $$ = mkchain($1, mkchain($3, 0) ); }
133 | uexpr SCOMMA other
134 { $$ = mkchain($1, mkchain($3, 0) ); }
135 | other SCOMMA uexpr
136 { $$ = mkchain($1, mkchain($3, 0) ); }
137 | other SCOMMA other
138 { $$ = mkchain($1, mkchain($3, 0) ); }
139 | out2 SCOMMA uexpr
140 { $$ = hookup($1, mkchain($3, 0) ); }
141 | out2 SCOMMA other
142 { $$ = hookup($1, mkchain($3, 0) ); }
145 other: complex_const
146 | SLPAR uexpr SCOMMA dospec SRPAR
147 { $$ = mkiodo($4, mkchain($2, 0) ); }
148 | SLPAR other SCOMMA dospec SRPAR
149 { $$ = mkiodo($4, mkchain($2, 0) ); }
150 | SLPAR out2 SCOMMA dospec SRPAR
151 { $$ = mkiodo($4, $2); }
154 in_ioctl:
155 { startioctl(); }