1 CUP version 0.10k is a maintenance release.
3 CUP will now accept a filename on the command-line if it is the last
4 argument and does not start with "-". This allows better GUI
5 integration. Some unix-isms in end-of-line handling have been fixed,
6 too; thanks to Jean Vaucher <vaucher@iro.umontreal.ca> for the tip.
8 The java_cup.runtime.Scanner interface has been refined to allow
9 the scanner to return null to signal EOF. JLex and JFlex users will
10 like this, as it means they can use the default scanner EOF behavior.
12 Bruce Hutton <b_hutton@cs.auckland.ac.nz>, Zerksis Umrigar <zdu@acm.org>,
13 and Vladimir Antonevich <Vladimir.Antonevich@solcorp.com> all sent bug
14 reports touching on erroneous error recovery in the parser runtime.
15 Dr. Hutton provided the fixes that I've adopted; Zerksis sent a very
16 helpful CUP-vs-bison test case. If you're in a position to notice
17 correct/incorrect error recovery and this release works better for you
18 than previous ones, thank them --- and send me email so I know whether
19 we've quashed this bug for good.
21 Klaus Georg Barthelmann <barthel@Informatik.Uni-Mainz.DE> caught an
22 oversight in the constructors for java_cup.runtime.Symbol. I've also
23 taken an obsolete constructor allowing specification of a start state
24 for some symbol to package-scope; if this causes anyone backwards
25 compatibility problems, email me and I will consider changing it back.
28 Laboratory for Computer Science
29 Massachusetts Institute of Technology
31 ------------------------------------------------------------------------
32 CUP version 0.10j adds new features.
34 A "-version" command-line option is now accepted, which prints out the
35 working version of CUP and halts. This allows automatic version-checking,
36 for those applications which require it.
38 Broadened the CUP input grammar to allow CUP reserved words in package and
39 import statements, and in (non)terminal labels. In addition, semicolons
40 after 'action code', 'parser code', 'init code', and 'scan with' sections
41 have been made optional (if language noise annoys you). Also, these four
42 sections may now appear in any order, instead of the strict ordering
43 previously required. Finally, you can now spell 'non-terminal' as either
44 "non terminal" (old way) *or* "nonterminal" without upsetting CUP.
45 [Flexibility requested by Stefan Kahrs <S.M.Kahrs@ukc.ac.uk>]
46 [Package and import reserved word issues noted by Frank Rehberger,
47 Brandon Schendel, and Bernie Honeisen, among others.]
49 Clarified the parse table dumps generated by the -dump* options.
51 I have added code to lr_parser to detect illegal Symbol recycling by the
52 scanner and to throw an Error in this case. The scanner must return
53 a fresh Symbol object on each invocation, because these objects are
54 tagged with parse state and added to the parse stack. Object sharing
55 does evil things to the parser; don't do it (you won't get away with it).
56 [Symbol recycling problems reported by Ken Arnold <Ken.Arnold@Sun.COM>]
58 Improved scanner interface, designed by David MacMahon <davidm@smartsc.com>.
59 The new java_cup.runtime.Scanner interface is used by the default
60 implementation of lr_parser.scan(). See the manual for more details.
61 Old parsers will work with the new runtime, but parsers generated with
62 0.10j will not work with the runtime from earlier versions unless you
63 specify the (new) "-noscanner" option.
66 Laboratory for Computer Science
67 Massachusetts Institute of Technology
69 ------------------------------------------------------------------------
70 CUP version 0.10i is a maintenance release.
72 A one-off bug in the parser error-recovery code has been caught and corrected
73 by Chris Harris <ckharris@ucsd.edu>.
75 The fields in the emitted symbol class have been made public, rather than
76 package scope, since the class already was public.
78 The issues formerly addressed in Appendix D (accessing parser methods/fields
79 from the action class) have been partially addressed by adding a new
80 private final field named 'parser' to the action object that points to
81 the parser object. THIS INTRODUCES A POTENTIAL INCOMPATIBILITY if you had
82 previously defined a field named 'parser' in the 'action code {: ... :}'
83 portion of your grammar. The solution is to rename your field.
85 Finally, incorporated Jako Andras' suggestions to make CUP more friendly
88 A reminder: please submit bug-fixes or feature-additions as *patches*, not
89 complete archives. Your patch will have a greater chance of integration
90 into the distribution if you package each feature or fix as a separate patch,
91 instead of lumping everything together and leaving it to me to figure out
92 what you've changed and why.
95 Laboratory for Computer Science
96 Massachusetts Institute of Technology
98 ------------------------------------------------------------------------
99 CUP version 0.10h is a maintenance release.
101 Starting with this version, CUP encodes the various parser tables as strings
102 to get around java's 64k method-size limitation. This allows larger
103 parse tables and thus more complicated grammars.
105 Furthermore, a long-standing buglet that would cause CUP to occasionally
106 generate "Attempt to construct a duplicate state" internal errors has been
109 Another contributed Microsoft-compatible makefile has also been added
113 Laboratory for Computer Science
114 Massachusetts Institute of Technology
116 ------------------------------------------------------------------------
117 CUP version 0.10g contains bug fixes, added functionality, and
118 performance improvements. Thanks to Matthias Zenger, Peter Selinger,
119 Jaroslaw Kachinarz, Ian Davis and others for contributions.
121 - New command line option '-interface' added. This causes JavaCUP to
122 emit an *interface* with the symbol constants, instead of a
123 *class*. Without the command-line flag, behavior is identical to
124 v0.10f and before: the symbols are emitted as a class.
125 - (minor) Added toString() method to java_cup.runtime.Symbol and
126 modified the debugging parser to use it. This allows you to
127 override toString() to allow a more intelligible debugging parse.
128 - The CUP grammar has been extended to allow one to declare array types
129 for javaCUP terminals and non-terminals. Matthias Zenger first
130 suggested this feature; Peter Selinger was the first to show the
132 - The symbols prefixed with CUP$ now have the parser class file name
133 added to the prefix as well, to allow more than one parser object
134 per package. Thanks to Jaroslaw Kachniarz for pointing out this
136 - Fixed bug that prevented one from invoking the parser multiple times.
137 To quote Ian Davis, who found and diagnosed the bug:
138 Repeat invocations of the same instantiation of lr_parser.java to parse
139 distinct input statements fail for the simple reason that the stack is
140 not emptied at start of parsing, but the stack offset is reset to 0.
142 - Fixed bug with implicit start productions not receiving a RESULT.
143 - Fixed bug with RESULT assignments that are not right-most in the
145 - Updated documentation.
148 - All known bugs have been fixed.
149 - The java_cup.runtime.SymbolStack / java_cup.runtime.intStack
150 performance hack originally suggested by Matthias Zenger has been
151 postponed to the next release. By eliminating typecasts and
152 synchronized methods, a substantial performance improvement can be
153 obtained. Backwards-compatibility issues have forced the postponement
157 Laboratory for Computer Science
158 Massachusetts Institute of Technology
160 ------------------------------------------------------------------------
161 CUP version 0.10f is a maintenance release. The code has been cleaned up
162 for JDK 1.1 functionality. No major functionality has been added; any bugs
163 in 0.10e are still in 0.10f.
165 - Removed trailing semicolons from class definitions which upset strict
166 compilers (not Sun's javac, for some reason).
167 - Changed 'PrintStream's to 'PrintWriter's to eliminate deprecation
170 As of this release, the javaCUP code is being maintained by
171 C. Scott Ananian. Suggestions and bug-fixes should be sent to
172 cananian@alumni.princeton.edu.
176 - Precedence bug: rules unmarked by precedence information are treated
177 as if they had existing, but very low, precedence. This can mask
179 - Efficiency hack: java.util.Stack will be replaced in the next
180 release with a special-purpose stack to eliminate
181 performance-robbing type-casts.
182 - It has been suggested that the symbol *class* should be an
183 *interface* instead. This will be a command-line option in the next
187 Laboratory for Computer Science
188 Massachusetts Institute of Technology
190 ------------------------------------------------------------------------
191 CUP version 0.10e contains a few bug fixes from 0.10a
193 - %prec directive now works correctly
194 fixed by cananian@princeton.edu <C. Scott Ananian>
195 - Shift reduce conflicts are now correctly reported
196 fixed by danwang@cs.princeton.edu <Daniel . Wang>
197 - Error with reporting the positon of the error token also fixed
198 fixed by cananian@princeton.edu <C. Scott Ananian>
199 - INSTALL script now has a slightly more complex test.
200 - foo.java.diff included for changes from previous release
201 - Fixed more bugs with reporting of shift reduce conflicts.
202 fixed by danwang@cs.princeton.edu <Daniel . Wang>
203 - Fixed bug introduced by previous fix patches from <hosking@.cs.purdue.edu>
204 Added '\r' as a whitespace character for the lexer suggested by
206 - Fixed botched relase
208 Department of Computer Science
211 Last updated: 9/12/97 [DW]
212 ------------------------------------------------------------------------
213 Changes and Additions to CUP v0.9e
215 CUP version 0.10a is a major overhaul of CUP. The changes are severe,
216 meaning no backwards compatibility to older versions.
218 Here are the changes:
220 1. CUP now interfaces with the lexer in a completely different
221 manner. In the previous releases, a new class was used for every
222 distinct type of terminal. This release, however, uses only one class:
223 The Symbol class. The Symbol class has three instance variables which
224 are significant to the parser when passing information from the lexer.
225 The first is the value instance variable. This variable contains the
226 value of that terminal. It is of the type declared as the terminal type
227 in the parser specification file. The second two are the instance
228 variables left and right. They should be filled with the int value of
229 where in the input file, character-wise, that terminal was found.
231 2. Terminal and non-nonterminal declarations now can be declared in two
232 different ways to indicate the values of the terminals or non-terminals.
233 The previous declarations of the form
235 terminal {classname} {terminal} [, terminal ...];
237 still works. The classname, however indicates the type of the value of
238 the terminal or non-terminal, and does not indicate the type of object
239 placed on the parse stack.
241 A declaration, such as:
243 terminal {terminal} [, terminal ...];
245 indicates the terminals in the list hold no value.
247 3. CUP doesn't use the Symbol class for just terminals, but for all
248 non-terminals as well. When a production reduces to a non-terminal, a
249 new Symbol is created, and the value field is filled with the value of
250 that non-terminal. The user must know that the terminal and non terminal
251 declarations specify a type corresponding to the type of the value field
252 for the symbol representing that terminal or non-terminal.
254 4. Label references do not refer to the object on the parse stack, as in
255 the old CUP, but rather to the value of the value instance variable of
256 the Symbol that represents that terminal or non-terminal. Hence,
257 references to terminal and non-terminal values is direct, as opposed to
258 the old CUP, where the labels referred to objects containing the value
259 of the terminal or non-terminal.
261 5. The RESULT variable refers directly to the value of the non-terminal
262 to which a rule reduces, rather than to the object on the parse stack.
263 Hence, RESULT is of the same type the non-terminal to which it reduces,
264 as declared in the non terminal declaration. Again, the reference is
265 direct, rather than to something that will contain the data.
267 6. For every label, two more variables are declared, which are the label
268 plus left or the label plus right. These correspond to the left and
269 right locations in the input stream to which that terminal or
270 non-terminal came from. These values are propagated from the input
271 terminals, so that the starting non-terminal should have a left value of
272 0 and a right value of the location of the last character read.
274 7. A call to parse() or debug_parse() return a Symbol. This Symbol is
275 of the start non-terminal, so the value field contains the final RESULT
278 8. CUP now has precedenced terminals. a new declaration section,
279 occurring between the terminal and non-terminal declarations and the
280 grammar specifies the precedence and associativity of rules. The
281 declarations are of the form:
283 precedence {left| right | nonassoc} terminal[, terminal ...];
286 The terminals are assigned a precedence, where terminals on the same
287 line have equal precedences, and the precedence declarations farther
288 down the list of precedence declarations have higher precedence. left,
289 right and nonassoc specify the associativity of these terminals. left
290 associativity corresponds to a reduce on conflict, right to a shift on
291 conflict, and nonassoc to an error on conflict. Hence, ambiguous
292 grammars may now be used. For a better explanation, see the manual.
294 9. Finally the new CUP adds contextual precedence. A production may be
297 lhs ::= {right hand side list of terminals, non-terminals and actions}
300 this production would then have a precedence equal to the terminal
301 specified after the "%prec". Hence, shift/reduce conflicts can be
302 contextually resolved. Note that the "%prec terminal" part comes after
303 all actions strings. It does not come before the last action string.
305 For more information read the manual, found in manual.html
308 Department of Computer Science
311 Last updated: 7/3/96 [FF]