CUP version 0.10k is a maintenance release. CUP will now accept a filename on the command-line if it is the last argument and does not start with "-". This allows better GUI integration. Some unix-isms in end-of-line handling have been fixed, too; thanks to Jean Vaucher for the tip. The java_cup.runtime.Scanner interface has been refined to allow the scanner to return null to signal EOF. JLex and JFlex users will like this, as it means they can use the default scanner EOF behavior. Bruce Hutton , Zerksis Umrigar , and Vladimir Antonevich all sent bug reports touching on erroneous error recovery in the parser runtime. Dr. Hutton provided the fixes that I've adopted; Zerksis sent a very helpful CUP-vs-bison test case. If you're in a position to notice correct/incorrect error recovery and this release works better for you than previous ones, thank them --- and send me email so I know whether we've quashed this bug for good. Klaus Georg Barthelmann caught an oversight in the constructors for java_cup.runtime.Symbol. I've also taken an obsolete constructor allowing specification of a start state for some symbol to package-scope; if this causes anyone backwards compatibility problems, email me and I will consider changing it back. C. Scott Ananian Laboratory for Computer Science Massachusetts Institute of Technology Jul-24-1999 [CSA] ------------------------------------------------------------------------ CUP version 0.10j adds new features. A "-version" command-line option is now accepted, which prints out the working version of CUP and halts. This allows automatic version-checking, for those applications which require it. Broadened the CUP input grammar to allow CUP reserved words in package and import statements, and in (non)terminal labels. In addition, semicolons after 'action code', 'parser code', 'init code', and 'scan with' sections have been made optional (if language noise annoys you). Also, these four sections may now appear in any order, instead of the strict ordering previously required. Finally, you can now spell 'non-terminal' as either "non terminal" (old way) *or* "nonterminal" without upsetting CUP. [Flexibility requested by Stefan Kahrs ] [Package and import reserved word issues noted by Frank Rehberger, Brandon Schendel, and Bernie Honeisen, among others.] Clarified the parse table dumps generated by the -dump* options. I have added code to lr_parser to detect illegal Symbol recycling by the scanner and to throw an Error in this case. The scanner must return a fresh Symbol object on each invocation, because these objects are tagged with parse state and added to the parse stack. Object sharing does evil things to the parser; don't do it (you won't get away with it). [Symbol recycling problems reported by Ken Arnold ] Improved scanner interface, designed by David MacMahon . The new java_cup.runtime.Scanner interface is used by the default implementation of lr_parser.scan(). See the manual for more details. Old parsers will work with the new runtime, but parsers generated with 0.10j will not work with the runtime from earlier versions unless you specify the (new) "-noscanner" option. C. Scott Ananian Laboratory for Computer Science Massachusetts Institute of Technology Jul-24-1999 [CSA] ------------------------------------------------------------------------ CUP version 0.10i is a maintenance release. A one-off bug in the parser error-recovery code has been caught and corrected by Chris Harris . The fields in the emitted symbol class have been made public, rather than package scope, since the class already was public. The issues formerly addressed in Appendix D (accessing parser methods/fields from the action class) have been partially addressed by adding a new private final field named 'parser' to the action object that points to the parser object. THIS INTRODUCES A POTENTIAL INCOMPATIBILITY if you had previously defined a field named 'parser' in the 'action code {: ... :}' portion of your grammar. The solution is to rename your field. Finally, incorporated Jako Andras' suggestions to make CUP more friendly to makefiles. A reminder: please submit bug-fixes or feature-additions as *patches*, not complete archives. Your patch will have a greater chance of integration into the distribution if you package each feature or fix as a separate patch, instead of lumping everything together and leaving it to me to figure out what you've changed and why. C. Scott Ananian Laboratory for Computer Science Massachusetts Institute of Technology Feb-18-1999 [CSA] ------------------------------------------------------------------------ CUP version 0.10h is a maintenance release. Starting with this version, CUP encodes the various parser tables as strings to get around java's 64k method-size limitation. This allows larger parse tables and thus more complicated grammars. Furthermore, a long-standing buglet that would cause CUP to occasionally generate "Attempt to construct a duplicate state" internal errors has been fixed. Another contributed Microsoft-compatible makefile has also been added to the distribution. C. Scott Ananian Laboratory for Computer Science Massachusetts Institute of Technology Feb-10-1999 [CSA] ------------------------------------------------------------------------ CUP version 0.10g contains bug fixes, added functionality, and performance improvements. Thanks to Matthias Zenger, Peter Selinger, Jaroslaw Kachinarz, Ian Davis and others for contributions. - New command line option '-interface' added. This causes JavaCUP to emit an *interface* with the symbol constants, instead of a *class*. Without the command-line flag, behavior is identical to v0.10f and before: the symbols are emitted as a class. - (minor) Added toString() method to java_cup.runtime.Symbol and modified the debugging parser to use it. This allows you to override toString() to allow a more intelligible debugging parse. - The CUP grammar has been extended to allow one to declare array types for javaCUP terminals and non-terminals. Matthias Zenger first suggested this feature; Peter Selinger was the first to show the right way to do it. - The symbols prefixed with CUP$ now have the parser class file name added to the prefix as well, to allow more than one parser object per package. Thanks to Jaroslaw Kachniarz for pointing out this problem. - Fixed bug that prevented one from invoking the parser multiple times. To quote Ian Davis, who found and diagnosed the bug: Repeat invocations of the same instantiation of lr_parser.java to parse distinct input statements fail for the simple reason that the stack is not emptied at start of parsing, but the stack offset is reset to 0. This has been fixed. - Fixed bug with implicit start productions not receiving a RESULT. - Fixed bug with RESULT assignments that are not right-most in the production. - Updated documentation. Known issues: - All known bugs have been fixed. - The java_cup.runtime.SymbolStack / java_cup.runtime.intStack performance hack originally suggested by Matthias Zenger has been postponed to the next release. By eliminating typecasts and synchronized methods, a substantial performance improvement can be obtained. Backwards-compatibility issues have forced the postponement of the code merge. C. Scott Ananian Laboratory for Computer Science Massachusetts Institute of Technology 3/24/98 [CSA] ------------------------------------------------------------------------ CUP version 0.10f is a maintenance release. The code has been cleaned up for JDK 1.1 functionality. No major functionality has been added; any bugs in 0.10e are still in 0.10f. - Removed trailing semicolons from class definitions which upset strict compilers (not Sun's javac, for some reason). - Changed 'PrintStream's to 'PrintWriter's to eliminate deprecation warnings. As of this release, the javaCUP code is being maintained by C. Scott Ananian. Suggestions and bug-fixes should be sent to cananian@alumni.princeton.edu. Known issues: - Precedence bug: rules unmarked by precedence information are treated as if they had existing, but very low, precedence. This can mask parser conflicts. - Efficiency hack: java.util.Stack will be replaced in the next release with a special-purpose stack to eliminate performance-robbing type-casts. - It has been suggested that the symbol *class* should be an *interface* instead. This will be a command-line option in the next release. C. Scott Ananian Laboratory for Computer Science Massachusetts Institute of Technology 12/21/97 [CSA] ------------------------------------------------------------------------ CUP version 0.10e contains a few bug fixes from 0.10a - %prec directive now works correctly fixed by cananian@princeton.edu - Shift reduce conflicts are now correctly reported fixed by danwang@cs.princeton.edu - Error with reporting the positon of the error token also fixed fixed by cananian@princeton.edu - INSTALL script now has a slightly more complex test. - foo.java.diff included for changes from previous release - Fixed more bugs with reporting of shift reduce conflicts. fixed by danwang@cs.princeton.edu - Fixed bug introduced by previous fix patches from Added '\r' as a whitespace character for the lexer suggested by (dladd@spyglass.com) - Fixed botched relase Daniel Wang Department of Computer Science Princeton University Last updated: 9/12/97 [DW] ------------------------------------------------------------------------ Changes and Additions to CUP v0.9e CUP version 0.10a is a major overhaul of CUP. The changes are severe, meaning no backwards compatibility to older versions. Here are the changes: 1. CUP now interfaces with the lexer in a completely different manner. In the previous releases, a new class was used for every distinct type of terminal. This release, however, uses only one class: The Symbol class. The Symbol class has three instance variables which are significant to the parser when passing information from the lexer. The first is the value instance variable. This variable contains the value of that terminal. It is of the type declared as the terminal type in the parser specification file. The second two are the instance variables left and right. They should be filled with the int value of where in the input file, character-wise, that terminal was found. 2. Terminal and non-nonterminal declarations now can be declared in two different ways to indicate the values of the terminals or non-terminals. The previous declarations of the form terminal {classname} {terminal} [, terminal ...]; still works. The classname, however indicates the type of the value of the terminal or non-terminal, and does not indicate the type of object placed on the parse stack. A declaration, such as: terminal {terminal} [, terminal ...]; indicates the terminals in the list hold no value. 3. CUP doesn't use the Symbol class for just terminals, but for all non-terminals as well. When a production reduces to a non-terminal, a new Symbol is created, and the value field is filled with the value of that non-terminal. The user must know that the terminal and non terminal declarations specify a type corresponding to the type of the value field for the symbol representing that terminal or non-terminal. 4. Label references do not refer to the object on the parse stack, as in the old CUP, but rather to the value of the value instance variable of the Symbol that represents that terminal or non-terminal. Hence, references to terminal and non-terminal values is direct, as opposed to the old CUP, where the labels referred to objects containing the value of the terminal or non-terminal. 5. The RESULT variable refers directly to the value of the non-terminal to which a rule reduces, rather than to the object on the parse stack. Hence, RESULT is of the same type the non-terminal to which it reduces, as declared in the non terminal declaration. Again, the reference is direct, rather than to something that will contain the data. 6. For every label, two more variables are declared, which are the label plus left or the label plus right. These correspond to the left and right locations in the input stream to which that terminal or non-terminal came from. These values are propagated from the input terminals, so that the starting non-terminal should have a left value of 0 and a right value of the location of the last character read. 7. A call to parse() or debug_parse() return a Symbol. This Symbol is of the start non-terminal, so the value field contains the final RESULT assignment. 8. CUP now has precedenced terminals. a new declaration section, occurring between the terminal and non-terminal declarations and the grammar specifies the precedence and associativity of rules. The declarations are of the form: precedence {left| right | nonassoc} terminal[, terminal ...]; ... The terminals are assigned a precedence, where terminals on the same line have equal precedences, and the precedence declarations farther down the list of precedence declarations have higher precedence. left, right and nonassoc specify the associativity of these terminals. left associativity corresponds to a reduce on conflict, right to a shift on conflict, and nonassoc to an error on conflict. Hence, ambiguous grammars may now be used. For a better explanation, see the manual. 9. Finally the new CUP adds contextual precedence. A production may be declare as followed: lhs ::= {right hand side list of terminals, non-terminals and actions} %prec {terminal}; this production would then have a precedence equal to the terminal specified after the "%prec". Hence, shift/reduce conflicts can be contextually resolved. Note that the "%prec terminal" part comes after all actions strings. It does not come before the last action string. For more information read the manual, found in manual.html Frank Flannery Department of Computer Science Princeton University Last updated: 7/3/96 [FF]