Update to byacc 20140715 (only concerns regression tests being fixed)
Directly use regression test from upstream PR: 191020 Submitted by: gcooper (yaneurabeya@gmail.com)
This commit is contained in:
parent
c253b272de
commit
81a50b4997
@ -1,3 +1,38 @@
|
||||
2014-07-15 Thomas E. Dickey <tom@invisible-island.net>
|
||||
|
||||
* aclocal.m4: resync with my-autoconf (no change to configure script)
|
||||
|
||||
* VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile:
|
||||
bump
|
||||
|
||||
* test/run_test.sh:
|
||||
make top-level "make check" work again, by adding another step to filtering
|
||||
the test results.
|
||||
|
||||
2014-07-14 Thomas E. Dickey <tom@invisible-island.net>
|
||||
|
||||
* test/run_test.sh: changes from Garrett Cooper's patch:
|
||||
a) ensure that the script returns an error-code if there are differences
|
||||
b) escape "." character in left side of sed expression for $YACC
|
||||
c) ensure that $ifBTYACC has a value
|
||||
|
||||
* test/btyacc/big_b.output, test/btyacc/big_l.output, test/btyacc/help.output, test/btyacc/no_b_opt.output, test/btyacc/no_output2.output, test/btyacc/no_p_opt.output, test/btyacc/nostdin.output:
|
||||
regen (reminder by Garrett Cooper)
|
||||
|
||||
2014-07-14 Garrett.Cooper
|
||||
|
||||
* test/btyacc/err_inherit1.error, test/btyacc/err_inherit2.error, test/btyacc/err_inherit3.error, test/btyacc/err_inherit4.error, test/btyacc/err_inherit5.error, test/btyacc/err_syntax1.error, test/btyacc/err_syntax10.error, test/btyacc/err_syntax11.error, test/btyacc/err_syntax12.error, test/btyacc/err_syntax13.error, test/btyacc/err_syntax14.error, test/btyacc/err_syntax15.error, test/btyacc/err_syntax16.error, test/btyacc/err_syntax17.error, test/btyacc/err_syntax18.error, test/btyacc/err_syntax19.error, test/btyacc/err_syntax2.error, test/btyacc/err_syntax21.error, test/btyacc/err_syntax22.error, test/btyacc/err_syntax23.error, test/btyacc/err_syntax24.error, test/btyacc/err_syntax25.error, test/btyacc/err_syntax26.error, test/btyacc/err_syntax27.error, test/btyacc/err_syntax3.error, test/btyacc/err_syntax4.error, test/btyacc/err_syntax5.error, test/btyacc/err_syntax6.error, test/btyacc/err_syntax7.error, test/btyacc/err_syntax7a.error, test/btyacc/err_syntax7b.error, test/btyacc/err_syntax8.error, test/btyacc/err_syntax8a.error, test/btyacc/err_syntax9.error, test/yacc/err_syntax1.error, test/yacc/err_syntax10.error, test/yacc/err_syntax11.error, test/yacc/err_syntax12.error, test/yacc/err_syntax13.error, test/yacc/err_syntax14.error, test/yacc/err_syntax15.error, test/yacc/err_syntax16.error, test/yacc/err_syntax17.error, test/yacc/err_syntax18.error, test/yacc/err_syntax19.error, test/yacc/err_syntax2.error, test/yacc/err_syntax21.error, test/yacc/err_syntax22.error, test/yacc/err_syntax23.error, test/yacc/err_syntax24.error, test/yacc/err_syntax25.error, test/yacc/err_syntax26.error, test/yacc/err_syntax27.error, test/yacc/err_syntax3.error, test/yacc/err_syntax4.error, test/yacc/err_syntax5.error, test/yacc/err_syntax6.error, test/yacc/err_syntax7.error, test/yacc/err_syntax7a.error, test/yacc/err_syntax7b.error, test/yacc/err_syntax8.error, test/yacc/err_syntax8a.error, test/yacc/err_syntax9.error:
|
||||
regen
|
||||
|
||||
2014-05-27 Tom.Shields
|
||||
|
||||
* main.c: remove obsolete -D option from usage message
|
||||
|
||||
2014-05-27 Thomas E. Dickey <tom@invisible-island.net>
|
||||
|
||||
* VERSION, package/byacc.spec, package/debian/changelog, test/yacc/big_b.output, test/yacc/big_l.output, test/yacc/help.output, test/yacc/no_b_opt.output, test/yacc/no_output2.output, test/yacc/no_p_opt.output, test/yacc/nostdin.output:
|
||||
bump
|
||||
|
||||
2014-04-22 Thomas E. Dickey <tom@invisible-island.net>
|
||||
|
||||
* mstring.c:
|
||||
|
@ -1,4 +1,4 @@
|
||||
MANIFEST for byacc-20140422, version t20140422
|
||||
MANIFEST for byacc-20140715, version t20140715
|
||||
--------------------------------------------------------------------------------
|
||||
MANIFEST this file
|
||||
ACKNOWLEDGEMENTS original version of byacc - 1993
|
||||
|
@ -1,385 +0,0 @@
|
||||
Tom Shields, March 17, 2014
|
||||
|
||||
PARKING LOT ISSUES:
|
||||
-------------------
|
||||
- verify debian packaging still works?
|
||||
|
||||
- there are no #line directives in y.tab.i, other than those that come
|
||||
from the input file and the skeleton file; to fix this, would need to
|
||||
count output lines in externs_file and add 'write_externs_lineno()'
|
||||
similar to 'write_code_lineno()'
|
||||
- if there are no defined symbols, the .tab.h file isn't empty (weird case,
|
||||
may not be worth fixing)
|
||||
- consider: treat []-actions identical to {}-actions if not processing a
|
||||
backtracking parser (avoids test case error)?
|
||||
|
||||
|
||||
BTYACC CHANGES CURRENTLY DEFERRED, BY FILE:
|
||||
-------------------------------------------
|
||||
|
||||
push.skel
|
||||
- skeleton for a 'push' parser
|
||||
- needs to be upgraded match the structure of yaccpar.skel
|
||||
|
||||
defs.h
|
||||
- adopt '%include' changes
|
||||
- adopt '%define'/'%ifdef'/'%endif'
|
||||
- adopt -E flag to print preprocessed grammar to stdout
|
||||
|
||||
error.c
|
||||
- adopt '%include' changes
|
||||
- NOTE: there is a btyacc change that might be worth adopting in byacc
|
||||
[FileError() refactoring to eliminate duplicated code in most of the
|
||||
error message functions]
|
||||
|
||||
main.c
|
||||
- adopt '%define' changes
|
||||
- adopt '-DNAME' command line option to define preprocessor variable NAME
|
||||
- adopt -E flag to print preprocessed grammar to stdout
|
||||
- adopt '-S skeleton_file' command line option to select an alternate parser
|
||||
skeleton file
|
||||
- the skeleton file named by the -S flag is used as provided to open the
|
||||
file; consider a change to this behavior to check whether the named file
|
||||
has a path prefix, and if not, look in 'installation' directory if the
|
||||
file is not found in the working directory
|
||||
|
||||
output.c
|
||||
- adopt '%include' changes
|
||||
|
||||
reader.c
|
||||
- adopt '%include' changes
|
||||
- adopt '%define'/'%ifdef'/'%endif' changes
|
||||
- adopt -E flag to print preprocessed grammar to stdout
|
||||
- NOTE: there is a btyacc change that might be worth adopting in byacc
|
||||
[copy_string() & copy_comment() refactoring to eliminate duplicated
|
||||
code in copy_text() and copy_union()]
|
||||
|
||||
warshall.c
|
||||
- NOTE: there is a btyacc change that might be worth adopting in byacc
|
||||
[shifting 'mask' incrementally rather than literal '1' by a variable
|
||||
amount each time thru the loop]
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
new files:
|
||||
----------
|
||||
|
||||
skel2c
|
||||
- modified from btyacc distribution: don't generate #include defs.h
|
||||
- extended syntax recognized to include '%% insert VERSION here', generating
|
||||
the defines for YYMAJOR, YYMINOR and YYPATCH at that point
|
||||
- made generated tables type 'const char *const' to match skelton.c from
|
||||
byacc-20130925 baseline
|
||||
- added code to append text for write_section() to end of generated skeleton.c
|
||||
- remove conversion of tab to \t in generated skeleton.c
|
||||
- extended syntax recognized to include '%%ifdef', '%%ifndef', '%%else' and
|
||||
'%%endif'; used in yaccpar.skel to bracket code that is specific to
|
||||
backtracking
|
||||
|
||||
yaccpar.skel.old
|
||||
- created from skeleton.c in byacc-20140101 baseline; use of this skeleton
|
||||
will create a version of skeleton.c that is close to that in the
|
||||
byacc-20140101 baseline
|
||||
- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate
|
||||
yyerror() invocation dynamically; YYERROR_CALL() is already generated
|
||||
earlier, and so can be used in the skeleton to simplify
|
||||
- added 'const' to types in '%% tables' section to match what skel2c,
|
||||
start_int_table() and state_str_table() generate
|
||||
- added a few cosmetic changes (e.g., added some additional comments,
|
||||
reworded debugging output to match yaccpar.skel, changed yygrowstack()
|
||||
to return YYENOMEM for 'out of memory' error, rather than -1, to match
|
||||
yaccpar.skel; changed yyparse() return value from 1 to 2 for the
|
||||
'out of memory' error to match yaccpar.skel)
|
||||
- added '#ifndef'/'#endif' around '#define YYINITSTACKSIZE 200' to allow
|
||||
the value to be changed at compile time
|
||||
- changed 'printf(' to 'fprintf(stderr, '; added stack depth (yydepth) to
|
||||
debugging output from yaccpar.skel
|
||||
- use 'YYINT' rather than 'short' for integer table types
|
||||
|
||||
yaccpar.skel
|
||||
- renamed from btyaccpa.ske, merged with btyacc-c.ske
|
||||
- modified from btyacc distribution to match the latest byacc-20140101
|
||||
skeleton structure & data structures
|
||||
- make local functions static
|
||||
- change "virtual memory exceeded" to "memory exhausted" for bison
|
||||
compatibility
|
||||
- change debug output generation from printf/puts/putc onto stdout to use
|
||||
fprintf/fputs/fputc onto stderr; include
|
||||
stack depth and whether or not in trial parsing
|
||||
- changed types of generated string tables to be 'const pointer to const char'
|
||||
- check all malloc()/realloc() return values, ensure return value of
|
||||
yyparse() = 2 if parsing failed due to memory exhaustion
|
||||
- change YYDBPR() macro to YYSTYPE_TOSTRING(); define semantics as delivering
|
||||
a char* value representing a semantic value (e.g., yylval or yyval, or the
|
||||
contents of an entry on the semantic stack); additional parameter passed:
|
||||
grammar symbol # (to assist interpretation of semantic value)
|
||||
- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to
|
||||
yylval) for bison compatibility; add yyloc (corresponding to yyval)
|
||||
- move default definition of YYLTYPE into output.c, generating a typedef
|
||||
- add '#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)'/'#endif' around
|
||||
all lines specific to position processing
|
||||
- add '#if defined(YYDESTRUCT_CALL)'/'#endif' around all lines specific to
|
||||
semantic & position stack processing to reclaim memory associated with
|
||||
discarded symbols
|
||||
- add '%%ifdef YYBTYACC'/'%%endif' around all lines specific to backtrack
|
||||
parsing; converted by skel2c into '#if defined(YYBTYACC)'/'#endif'
|
||||
- distinguish between "yacc stack overflow" and "memory exhausted" situations
|
||||
- consolidated termination cleanup code; introduced yyreturn, set to 2 after
|
||||
labels yyoverflow/yyenomem, set to 1 after label yyabort, set to 0 after
|
||||
label yyaccept; all termination cases jump to label yyreturn, which does
|
||||
any cleanup then returns yyreturn value
|
||||
- replaced YYDELETEVAL & YYDELETEPOSN user-supplied macro capability by
|
||||
implementation of byacc-generated yydestruct() as defined by bison
|
||||
compatible %destructor mechanism
|
||||
- moved invocation of 'YYREDUCEPOSNFUNC' macro to immediately prior to, rather
|
||||
than after, execution of final rule action (so that, at some future
|
||||
date, implementation extensions can be added to enable custom calculation
|
||||
of locations associated with non-terminals within rule actions); deleted
|
||||
unnecessary flag 'reduce_posn'; deleted 'YYCALLREDUCEPOSN' macro; deleted
|
||||
C++ variant of 'YYREDUCEPOSNFUNC' invocation
|
||||
- adopt approach similar to bison for default computation of yyloc; change
|
||||
macro 'YYREDUCEPOSNFUNC' name to 'YYLLOC_DEFAULT' for bison compatibility;
|
||||
added 'yyerror_loc_range[2]' to hold start & end locations for error
|
||||
situations that pop the stack
|
||||
- use 'YYINT' rather than 'short' for integer table types, and for indexing
|
||||
parser tables
|
||||
|
||||
readskel.c
|
||||
http://www.verisign.com/index.html- replaced error() with fprintf()
|
||||
|
||||
mstring.h
|
||||
- moved contents of mstring.h to defs.h - mstring.h is obsolete
|
||||
|
||||
mstring.c
|
||||
- replaced include of mstring.h with defs.h
|
||||
- changed 'START' to 'HEAD' to remove conflict with 'START' used for
|
||||
the start symbol defined in defs.h
|
||||
|
||||
modified byacc files:
|
||||
---------------------
|
||||
|
||||
skeleton.c
|
||||
- skeleton.c is now generated from the appropriate skeleton file by 'skel2c'
|
||||
|
||||
configure.in
|
||||
- added configuration for --enable-btyacc option; if 'yes' add '-DYYBTYACC'
|
||||
to DEFINES in makefile.in; --enable-btyacc defaults to 'no'
|
||||
- added configuration for --with-max-table-size option; if present,
|
||||
overrides the value of MAXTABLE defined in defs.h
|
||||
- regenerate configure using autoconf
|
||||
|
||||
makefile.in
|
||||
- added mstring.c to C_FILES
|
||||
- added mstring$o to OBJS
|
||||
- added @DEFINES@ as value of DEFINES make variable
|
||||
- added new make variable SKELETON with value 'yaccpar.skel'
|
||||
- added rule to generate skeleton.c from $(SKELETON), depending on skel2c
|
||||
and makefile
|
||||
- added rm -f skeleton.c distclean rule
|
||||
- moved dependency on makefile from only main$o & skeleton$o to $(OBJS),
|
||||
since if ./configure is run changing, for example, from --enable-btyacc
|
||||
to --disable-btyacc, all files must be recompiled to ensure a clean
|
||||
executable
|
||||
- add @MAXTABLE@ for optional '-DMAXTABLE=nnn' if configured using
|
||||
--with-max-table-size=nnn
|
||||
- changed 'cd test && rn 0f test-*'to 'rm -f $(testdir)/test-*'
|
||||
|
||||
test/run_test.sh
|
||||
- ???
|
||||
|
||||
test/run_make.sh
|
||||
- ???
|
||||
|
||||
defs.h
|
||||
- moved contents of mstring.h to defs.h - mstring.h is obsolete
|
||||
- added <limits.h> to get the various system defined machine limits;
|
||||
changed definitions of MAXCHAR, MAXSHORT, MINSHORT & BITS_PER_WORD to use
|
||||
defines from <limits.h>; changed definitions of BIT and SETBIT to use
|
||||
value of BITS_PER_WORD
|
||||
- added typedef for __compar_fn_t, conditioned on _COMPAR_FN_T being
|
||||
undefined (at least for Mac OSX environment)
|
||||
- adopt new symbol class values ACTION and ARGUMENT
|
||||
- adopt changes/additions used by inherited attribute processing
|
||||
- clean up locations of extern function definitions to match where they
|
||||
actually live in source files
|
||||
- adopt error functions from inherited attribute processing; added new error
|
||||
functions
|
||||
- added keyword code LOCATIONS for %locations
|
||||
- added keyword code DESTRUCTOR for %destructor
|
||||
- added extern decl for 'int locations'; true if %locations present
|
||||
- added extern decl for 'int backtrack'; initialized to 0 (= false), set to
|
||||
1 (= true) if -B flag is present
|
||||
- added extern decl for 'int destructor'; true if at least one %destructor
|
||||
present in grammar spec file
|
||||
- define 'YYINT' as the smallest C type that can be used to address a
|
||||
table of size 'MAXTABLE'; define 'YYINT' based on the value of
|
||||
'MAXTABLE' using the standard system type size definitions from <limits.h>;
|
||||
define 'MAXYYINT' and 'MINYYINT' accordingly
|
||||
- change 'Value_t' and 'Index_t' to 'YYINT' from 'short'
|
||||
- allow 'MAXTABLE' to be defined by '-DMAXTABLE=nnn' at compile-time
|
||||
|
||||
closure.c
|
||||
- changed print_closure(), print_EFF() and print_first_derives() to 'static';
|
||||
added fwd declarations
|
||||
- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
|
||||
used for variables/parameters that were related to variables/parameters
|
||||
declared as 'short'
|
||||
|
||||
error.c
|
||||
- adopt error functions from inherited attribute processing; added a few
|
||||
additional inherited attribute error functions
|
||||
|
||||
graph.c
|
||||
- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
|
||||
used for variables/parameters that were related to variables/parameters
|
||||
declared as 'short'
|
||||
|
||||
lalr.c
|
||||
- changed MAXSHORT to MAXYYINT
|
||||
|
||||
lr0.c
|
||||
- changed MAXSHORT to MAXYYINT
|
||||
- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
|
||||
used for variables/parameters that were related to variables/parameters
|
||||
declared as 'short'
|
||||
|
||||
main.c
|
||||
- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
|
||||
used for variables/parameters that were related to variables/parameters
|
||||
declared as 'short'
|
||||
|
||||
mkpar.c
|
||||
- backtracking attempts to resolve shift/reduce and reduce/reduce conflicts
|
||||
|
||||
output.c
|
||||
- generate prefix & YYPREFIX defines into externs file (-i, .tab.i) and
|
||||
code file (-r, .code.c); generate into output file (.tab.c) only if not
|
||||
using -r option; eliminates doubled output of prefix aliases if -r with
|
||||
no -i in y.tab.c and y.code.c or if -r & -i in y.tab.i and y.code.c
|
||||
- changed types of generated string tables to be 'const pointer to const char'
|
||||
- adopt backtracking as an alternative in cases where otherwise we have a
|
||||
conflict in the parsing actions (3, rather than 2, choices)
|
||||
- wrap defines file with (where "yy" is value of 'symbol_prefix')
|
||||
#ifndef __yy_defines_h_
|
||||
#define _yy_defines_h_
|
||||
|
||||
<defines>
|
||||
|
||||
#endif
|
||||
- avoid writing %%xdecls skeleton section twice if -r used
|
||||
- eliminated 'body_3' and 'trailer_2' skeleton segments - no need to generate
|
||||
yyerror() invocation dynamically; YYERROR_CALL() is already generated
|
||||
earlier, and can be used in the pareser skeleton
|
||||
- if -P flag (pure_parser), add yylloc as 2nd parameter to yylex()
|
||||
(declaration & call)
|
||||
- change YYPOSN to YYLTYPE and yyposn to yylloc (position corresponding to
|
||||
yylval) for bison compatibility; add yyloc (corresponding to yyval)
|
||||
- generate yylloc parameters for yylex & yyerror if %locations present
|
||||
- add location as 1st parameter to declaraion & invocation of yyerror() if
|
||||
%locations present
|
||||
- output backtrack parsing tables if -B flag is present
|
||||
- added generation of yystos[] with output_accessing_symbols() to allow
|
||||
translation from a parser internal state number to the corresponding
|
||||
grammar symbol number [0 .. nsyms) of the accessing symbol of that parser
|
||||
state; used in the generated code for YYDESTRUCT_CALL() &
|
||||
YYSTYPE_TOSTRING() to enable the correct semantic value union tag to be
|
||||
determined when executing the implementation of YYDESTRUCT_CALL() or
|
||||
YYSTYPE_TOSTRING() (similar to yystos[] in bison)
|
||||
- added to output_prefix(): yystos; yycindex & yyctable if compiling
|
||||
backtracking; yyloc & yylloc if %locations used
|
||||
- extended yyname[] to include all grammar symbols, not just the terminal
|
||||
symbols: '$end', 'error', '$accept', all non-terminals, including internally
|
||||
generated non-terminals for embedded actions in rules, and 'illegal-symbol'
|
||||
(which bison spells '$undefined'); '$end' already defined as a symbol 0,
|
||||
rathern than adding 'end-of-file' as the name of symbol 0; added
|
||||
'illegal-symbol' from byacc-20140101 (NOTE: the comment in the code that
|
||||
says byacc does not predefine '$end' and '$error' is incorrect; however,
|
||||
both bison and byacc spell '$error' as 'error')
|
||||
- added generation of #define YYTRANSLATE() from byacc-20140101, but changed
|
||||
the definition for the undefined symbol case because it is no longer in
|
||||
yyname[YYMAXTOKEN+1] but rather occurs after the last non-terminal symbol;
|
||||
added #define YYUNDFTOKEN to contain the index in yyname of 'illegal-symbol'
|
||||
- generate YYLTYPE in output_ltype() as a struct like for bison rather than
|
||||
using #define in yaccpar.skel
|
||||
- added 'write_code_lineno' invocation at start of 'output_prefix'
|
||||
- added 'write_code_lineno' invocation at start of 'output_pure_parser'
|
||||
- added 'write_code_lineno' invocation prior to generation of #include
|
||||
for externs file
|
||||
- added 'write_code_lineno' invocation after 1st 'write_section(fp, xdecls)'
|
||||
- added '++outline;' prior to output of '#define YYTRANSLATE' - this was
|
||||
actually causing almost all of the invocations of 'write_code_lineno' to
|
||||
put out the correct #line directive
|
||||
- corrected 'write_code_lineno' - the line number in a #line directive is
|
||||
the number of the next line, not the number of the #line line
|
||||
- changed MAXSHORT to MAXYYINT; changed 'high' local static from 'int' to
|
||||
'long' so that it can get higher than 'MAXYYINT' without machine-dependent
|
||||
behavior; changed related formats from '%d' to '%ld'
|
||||
- generate 'YYINT' rather than 'short' for integer table types
|
||||
- generate YYDESTRUCT_DECL & YYDESTRUCT_CALL macros, similar to YYERROR_DECL
|
||||
and YYERROR_CALL macros, that can be redefined by user, if desired, to add
|
||||
additional parameters to yydestruct() (and even change the 'yydestruct'
|
||||
function name)
|
||||
- if at least one %destructor present, generate yydestruct(); 1st parameter
|
||||
is a string indicating the context in which yydestruct() is invoked
|
||||
(e.g., discarding input token, discarding state on stack, cleanup when
|
||||
aborting); 2nd parameter is the internal grammar symbol number [0..nsyms)
|
||||
of the accessing symbol of the parser state on the top of the stack; 3rd
|
||||
parameter is a pointer to the semantic value to be reclaimed associated
|
||||
with the grammar symbol in the 2nd parameter; if %locations is defined,
|
||||
the 4th parameter is a pointer to the position value to be reclaimed
|
||||
associated with the grammar symbol in the 2nd parameter
|
||||
|
||||
reader.c
|
||||
- adopt []-actions, similar to {}-actions; {}-actions are only executed when
|
||||
not in trial mode, but []-actions are executed regardless of mode
|
||||
- adopt new symbol class values ACTION and ARGUMENT
|
||||
- adopt inherited attributes (syntax resembles arguments to non-terminal
|
||||
symbols)
|
||||
- adopt keyword table lookup from btyacc, modified to handle equivalence
|
||||
of '-' and '_' in spelling of keywords
|
||||
- adopt refactoring of tag table creation into cache_tag() for use in
|
||||
multiple locations
|
||||
- added new error functions in place of btyacc's generic error() function
|
||||
- changed '0' to 'NULL' for pointer initialization
|
||||
- reworked for-loop at end of get_line (part of DEFERRED '%ifdef/%endif' change)
|
||||
- added %locations directive for bison compatibility to enable position
|
||||
processing
|
||||
- added decl for 'int locations'; true if %locations present
|
||||
- added decl 'int backtrack'; initialized to 0 (= false), set to
|
||||
1 (= true) if -B flag is present
|
||||
- process %locations if present, set location = 1
|
||||
- only process []-actions and only generate 'if (!yytrial)' prefix for
|
||||
{}-actions if backtracking is enabled
|
||||
- add decl for 'int destructor'; true if at least one %destructor is present
|
||||
- add %destructor directive to enable semantic & position stack processing to
|
||||
reclaim memory associated with discarded symbols
|
||||
- process bison compatible %destructor (set destructor = 1); support @$ in
|
||||
%destructor code to reference the position value if %locations is defined
|
||||
- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
|
||||
used for variables/parameters that were related to variables/parameters
|
||||
declared as 'short'
|
||||
- if %locations present, support @N and @$ syntax as for bison to reference
|
||||
the locations associated with the N-th rhs symbol and the lhs symbol,
|
||||
respectively
|
||||
|
||||
symtab.c
|
||||
- initialize fields added to 'struct bucket' for non-terminal symbol
|
||||
inherited attributes
|
||||
|
||||
verbose.c
|
||||
- for parse states with conflicts, the contents of the y.output file include
|
||||
the trial shift and/or trial reduce actions
|
||||
- added output to the end of the verbose report showing the correspondance
|
||||
between grammar symbol #, internal parser symbol #, and grammar symbol name
|
||||
- changed 'short' to 'Value_t' (in some instances, 'Value_t' was already
|
||||
used for variables/parameters that were related to variables/parameters
|
||||
declared as 'short'
|
||||
|
||||
yacc.1
|
||||
- added options 'P', 'V', 'y' and '-o output_file' to the yacc command
|
||||
synopsis (already covered in the description section)
|
||||
- added options 'B', 'D' and 'L' to the yacc command synopsis; added text in
|
||||
the description section
|
||||
- added %locations description to the extensions section
|
@ -1,80 +0,0 @@
|
||||
Tom Shields, March 17, 2014
|
||||
|
||||
NOTE: README.BTYACC needs to be re-written (or another README file created)
|
||||
to explain how the extensions were adopted into the byacc-20140101 baseline.
|
||||
|
||||
bytacc changes adopted; see README.BTYACC for details.
|
||||
------------------------------------------------------
|
||||
|
||||
Changes to the skeleton to send debugging output to stderr.
|
||||
|
||||
Changes to the types of the grammar tables from 'short' to 'int' if
|
||||
MAXTABLE is defined to be > MAXSHORT for generation of large grammar tables
|
||||
for large grammars. This can be set with the invocation of configure
|
||||
using the --with-max-table-size=N option
|
||||
|
||||
Changes to add syntactic sugaring for definition and semantic processing
|
||||
of inherited attributes associated with non-terminal symbols on the rhs of
|
||||
rules. Inherited attributes are implemented as {}-actions, and as such may
|
||||
introduce reduce/reduce conflicts. The advantage over manual {}-actions is
|
||||
that checking is performed on the number and types of inherited attributes,
|
||||
and the positions on the semantic stack are automatically calculated.
|
||||
Identical actions produced by the inherited attribute syntax are collapsed
|
||||
into a single action, reducing reduce/reduce conflicts.
|
||||
|
||||
The %type specification is extended to define the types of inherited
|
||||
attributes associated with non-terminal symbols on the lhs of rules, in
|
||||
addition to its original purpose in yacc for specifying the type of the
|
||||
symbol itself on the parser's value stack. In order to permit the two
|
||||
aspects to be used independently, the <type> specification following
|
||||
%type is optional.
|
||||
|
||||
Added a mechanism to the parser skeleton for computing and propagating
|
||||
the text position of grammar symbols if %locations directive is present in
|
||||
the grammar specificaion, or if yacc is invoked with the -L flag. Includes
|
||||
support for "@$" and "@N" (for N an integer) in actions to refer to symbol
|
||||
locations.
|
||||
|
||||
Added a bison compatible %destructor directive to define a memory
|
||||
management mechanism to the parser skeleton that enables cleanup of semantic
|
||||
values and text positions associated with the parsing stack that are
|
||||
automatically discarded during error processing.
|
||||
|
||||
The following is only available if configure is invoked with the
|
||||
--enable-btyacc=yes:
|
||||
|
||||
Changes to enable backtracking with semantic disambiguation, if yacc is
|
||||
invoked with the -B flag. A yacc parser disambiguates shift/reduce conflicts
|
||||
by choosing to shift, and reduce/reduce conflicts by reducing using the
|
||||
earliest grammar rule (in the grammar specification). A btyacc parser handles
|
||||
a conflict by remembering the current parse point and entering into trial parse
|
||||
mode. In trial parse mode, the parser tries each of the conflicting options
|
||||
until the first successs or until all options are exhausted. If the parser
|
||||
runs into an error while in trial parse mode, it backtracks to the most recent
|
||||
conflict point and tries the next alternative. If the parser finds a
|
||||
successful parse, it backtracks to the point where it first entered trial parse
|
||||
mode and continues with normal parsing, using the action at the start of the
|
||||
successful trial path. Success in trial parse mode is achieved either by
|
||||
successfully reducing the start symbol at the end of input or by invocation of
|
||||
YYVALID (or YYVALID_NESTED). Semantic disambiguation is supported within
|
||||
[]-actions, which are always executed, with invocation of YYERROR to terminate
|
||||
a trial path or YYVALID (and YYVALID_NESTED). Yacc {}-actions are only
|
||||
executed during normal parsing.
|
||||
|
||||
|
||||
btyacc changes deferred:
|
||||
------------------------
|
||||
|
||||
The -S command line flag to enable use of an alternate parser skeleton,
|
||||
read from an external file.
|
||||
|
||||
Preprocessor statements: %define, %ifdef/%endif, %include.
|
||||
|
||||
|
||||
btyacc changes rejected:
|
||||
------------------------
|
||||
|
||||
The yyerror_detailed() option for error messages is replaced by the
|
||||
byacc feature for specifying options paramters to yyerror().
|
||||
|
||||
C++-specific features in the parser skeleton.
|
@ -1 +1 @@
|
||||
20140422
|
||||
20140715
|
||||
|
10
contrib/byacc/aclocal.m4
vendored
10
contrib/byacc/aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
dnl $Id: aclocal.m4,v 1.34 2014/04/06 19:16:18 tom Exp $
|
||||
dnl $Id: aclocal.m4,v 1.35 2014/07/15 19:38:05 tom Exp $
|
||||
dnl Macros for byacc configure script (Thomas E. Dickey)
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Copyright 2004-2013,2014 Thomas E. Dickey
|
||||
@ -28,7 +28,7 @@ dnl sale, use or other dealings in this Software without prior written
|
||||
dnl authorization.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
|
||||
dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49
|
||||
dnl ------------------
|
||||
dnl Conditionally generate script according to whether we're using a given autoconf.
|
||||
dnl
|
||||
@ -37,7 +37,7 @@ dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
|
||||
dnl $3 = code to use if AC_ACVERSION is older than $1.
|
||||
define([CF_ACVERSION_CHECK],
|
||||
[
|
||||
ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
|
||||
ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl
|
||||
ifdef([m4_version_compare],
|
||||
[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
|
||||
[CF_ACVERSION_COMPARE(
|
||||
@ -930,7 +930,7 @@ AC_PROG_AWK
|
||||
test -z "$AWK" && AC_MSG_ERROR(No awk program found)
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
|
||||
dnl CF_PROG_CC version: 4 updated: 2014/07/12 18:57:58
|
||||
dnl ----------
|
||||
dnl standard check for CC, plus followup sanity checks
|
||||
dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
|
||||
@ -940,7 +940,7 @@ CF_GCC_VERSION
|
||||
CF_ACVERSION_CHECK(2.52,
|
||||
[AC_PROG_CC_STDC],
|
||||
[CF_ANSI_CC_REQD])
|
||||
CF_CC_ENV_FLAGS
|
||||
CF_CC_ENV_FLAGS
|
||||
])dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: main.c,v 1.50 2014/04/22 23:34:47 tom Exp $ */
|
||||
/* $Id: main.c,v 1.51 2014/05/28 02:01:55 Tom.Shields Exp $ */
|
||||
|
||||
#include <signal.h>
|
||||
#ifndef _WIN32
|
||||
@ -208,7 +208,6 @@ usage(void)
|
||||
," -b file_prefix set filename prefix (default \"y.\")"
|
||||
," -B create a backtracking parser"
|
||||
," -d write definitions (" DEFINES_SUFFIX ")"
|
||||
," -D enable value stack memory reclamation"
|
||||
," -i write interface (y.tab.i)"
|
||||
," -g write a graphical description"
|
||||
," -l suppress #line directives"
|
||||
|
@ -1,8 +1,8 @@
|
||||
Summary: byacc - public domain Berkeley LALR Yacc parser generator
|
||||
%define AppProgram byacc
|
||||
%define AppVersion 20140422
|
||||
%define AppVersion 20140715
|
||||
%define UseProgram yacc
|
||||
# $XTermId: byacc.spec,v 1.20 2014/04/22 08:13:20 tom Exp $
|
||||
# $XTermId: byacc.spec,v 1.22 2014/07/15 19:36:54 tom Exp $
|
||||
Name: %{AppProgram}
|
||||
Version: %{AppVersion}
|
||||
Release: 1
|
||||
|
@ -1,3 +1,15 @@
|
||||
byacc (20140715) unstable; urgency=low
|
||||
|
||||
* maintenance updates
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Tue, 15 Jul 2014 15:36:54 -0400
|
||||
|
||||
byacc (20140527) unstable; urgency=low
|
||||
|
||||
* remove obsolete option from usage message
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Tue, 27 May 2014 22:01:55 -0400
|
||||
|
||||
byacc (20140422) unstable; urgency=low
|
||||
|
||||
* maintenance updates
|
||||
|
@ -1,8 +1,8 @@
|
||||
Summary: byacc - public domain Berkeley LALR Yacc parser generator
|
||||
%define AppProgram byacc
|
||||
%define AppVersion 20140422
|
||||
%define AppVersion 20140715
|
||||
%define UseProgram yacc
|
||||
# $XTermId: mingw-byacc.spec,v 1.3 2014/04/22 08:13:20 tom Exp $
|
||||
# $XTermId: mingw-byacc.spec,v 1.4 2014/07/15 19:36:54 tom Exp $
|
||||
Name: %{AppProgram}
|
||||
Version: %{AppVersion}
|
||||
Release: 1
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.9 2008/07/24 17:13:00 tonnerre Exp $
|
||||
#
|
||||
|
||||
DISTNAME= byacc-20140422
|
||||
DISTNAME= byacc-20140715
|
||||
PKGREVISION= 1
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= ftp://invisible-island.net/byacc/
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 64 of "./test/err_inherit1.y", unterminated argument list
|
||||
YACC: e - line 64 of "./err_inherit1.y", unterminated argument list
|
||||
namelist($c, $t
|
||||
^
|
||||
|
@ -1,5 +1,5 @@
|
||||
YACC: w - line 64 of "./test/err_inherit2.y", number of arguments of namelist doesn't agree with previous declaration
|
||||
YACC: w - line 64 of "./test/err_inherit2.y", type of argument 1 to namelist doesn't agree with previous declaration
|
||||
YACC: e - line 64 of "./test/err_inherit2.y", bad formal argument list
|
||||
YACC: w - line 64 of "./err_inherit2.y", number of arguments of namelist doesn't agree with previous declaration
|
||||
YACC: w - line 64 of "./err_inherit2.y", type of argument 1 to namelist doesn't agree with previous declaration
|
||||
YACC: e - line 64 of "./err_inherit2.y", bad formal argument list
|
||||
namelist($<tval>c, $t, extra): namelist NAME
|
||||
^
|
||||
|
@ -1,23 +1,23 @@
|
||||
YACC: w - line 64 of "./test/err_inherit3.y", number of arguments of namelist doesn't agree with previous declaration
|
||||
YACC: w - line 64 of "./test/err_inherit3.y", wrong number of arguments for namelist
|
||||
YACC: w - line 64 of "./err_inherit3.y", number of arguments of namelist doesn't agree with previous declaration
|
||||
YACC: w - line 64 of "./err_inherit3.y", wrong number of arguments for namelist
|
||||
namelist: namelist($c) NAME
|
||||
^
|
||||
YACC: w - line 64 of "./test/err_inherit3.y", unknown argument $c
|
||||
YACC: w - line 64 of "./test/err_inherit3.y", untyped argument $c
|
||||
YACC: w - line 65 of "./test/err_inherit3.y", unknown argument $t
|
||||
YACC: w - line 64 of "./err_inherit3.y", unknown argument $c
|
||||
YACC: w - line 64 of "./err_inherit3.y", untyped argument $c
|
||||
YACC: w - line 65 of "./err_inherit3.y", unknown argument $t
|
||||
{ $$->s = mksymbol($<tval>t, $<cval>c, $2);
|
||||
^
|
||||
YACC: w - line 65 of "./test/err_inherit3.y", unknown argument $c
|
||||
YACC: w - line 65 of "./err_inherit3.y", unknown argument $c
|
||||
{ $$->s = mksymbol($<tval>t, $<cval>c, $2);
|
||||
^
|
||||
YACC: w - line 69 of "./test/err_inherit3.y", unknown argument $t
|
||||
YACC: w - line 69 of "./err_inherit3.y", unknown argument $t
|
||||
{ $$->s = mksymbol($t, $c, $1);
|
||||
^
|
||||
YACC: w - line 69 of "./test/err_inherit3.y", untyped argument $t
|
||||
YACC: w - line 69 of "./test/err_inherit3.y", unknown argument $c
|
||||
YACC: w - line 69 of "./err_inherit3.y", untyped argument $t
|
||||
YACC: w - line 69 of "./err_inherit3.y", unknown argument $c
|
||||
{ $$->s = mksymbol($t, $c, $1);
|
||||
^
|
||||
YACC: w - line 69 of "./test/err_inherit3.y", untyped argument $c
|
||||
YACC: w - line 0 of "./test/err_inherit3.y", start symbol declaration requires arguments
|
||||
YACC: w - line 69 of "./err_inherit3.y", untyped argument $c
|
||||
YACC: w - line 0 of "./err_inherit3.y", start symbol declaration requires arguments
|
||||
YACC: 1 rule never reduced
|
||||
YACC: 3 shift/reduce conflicts.
|
||||
|
@ -1,13 +1,13 @@
|
||||
YACC: w - line 32 of "./test/err_inherit4.y", destructor redeclared
|
||||
YACC: w - line 32 of "./err_inherit4.y", destructor redeclared
|
||||
%destructor {
|
||||
^
|
||||
YACC: w - line 77 of "./test/err_inherit4.y", wrong number of default arguments for namelist
|
||||
YACC: w - line 77 of "./err_inherit4.y", wrong number of default arguments for namelist
|
||||
{ $$ = $1; @$ = @2; }
|
||||
^
|
||||
YACC: w - line 77 of "./test/err_inherit4.y", wrong type for default argument 2 to namelist
|
||||
YACC: w - line 77 of "./err_inherit4.y", wrong type for default argument 2 to namelist
|
||||
{ $$ = $1; @$ = @2; }
|
||||
^
|
||||
YACC: w - line 77 of "./test/err_inherit4.y", wrong type for default argument 1 to namelist
|
||||
YACC: w - line 77 of "./err_inherit4.y", wrong type for default argument 1 to namelist
|
||||
{ $$ = $1; @$ = @2; }
|
||||
^
|
||||
YACC: w - line 77 of "./test/err_inherit4.y", @2 references beyond the end of the current rule
|
||||
YACC: w - line 77 of "./err_inherit4.y", @2 references beyond the end of the current rule
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 74 of "./test/err_inherit5.y", illegal @$ or @N reference
|
||||
YACC: e - line 74 of "./err_inherit5.y", illegal @$ or @N reference
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 1 of "./test/err_syntax1.y", syntax error
|
||||
YACC: e - line 1 of "./err_syntax1.y", syntax error
|
||||
?% {
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: w - line 7 of "./test/err_syntax10.y", the type of '(' has been redeclared
|
||||
YACC: w - line 7 of "./test/err_syntax10.y", the type of '*' has been redeclared
|
||||
YACC: w - line 7 of "./test/err_syntax10.y", the type of '&' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax10.y", the type of '(' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax10.y", the type of '*' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax10.y", the type of '&' has been redeclared
|
||||
|
@ -1 +1 @@
|
||||
YACC: w - line 7 of "./test/err_syntax11.y", the precedence of '|' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax11.y", the precedence of '|' has been redeclared
|
||||
|
@ -1 +1 @@
|
||||
YACC: w - line 7 of "./test/err_syntax12.y", the value of text has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax12.y", the value of text has been redeclared
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 7 of "./test/err_syntax13.y", the start symbol text is a token
|
||||
YACC: e - line 7 of "./err_syntax13.y", the start symbol text is a token
|
||||
|
@ -1,2 +1,2 @@
|
||||
YACC: w - line 7 of "./test/err_syntax14.y", the start symbol has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax14.y", the start symbol has been redeclared
|
||||
YACC: e - the start symbol text2 is undefined
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 9 of "./test/err_syntax15.y", no grammar has been specified
|
||||
YACC: e - line 9 of "./err_syntax15.y", no grammar has been specified
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 14 of "./test/err_syntax16.y", a token appears on the lhs of a production
|
||||
YACC: e - line 14 of "./err_syntax16.y", a token appears on the lhs of a production
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 8 of "./test/err_syntax17.y", unterminated action
|
||||
YACC: e - line 8 of "./err_syntax17.y", unterminated action
|
||||
S: { error
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: w - line 9 of "./test/err_syntax18.y", $4 references beyond the end of the current rule
|
||||
YACC: w - line 9 of "./err_syntax18.y", $4 references beyond the end of the current rule
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 9 of "./test/err_syntax19.y", illegal $-name
|
||||
YACC: e - line 9 of "./err_syntax19.y", illegal $-name
|
||||
{ $$ = $<oops>; }
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 1 of "./test/err_syntax2.y", unmatched /*
|
||||
YACC: e - line 1 of "./err_syntax2.y", unmatched /*
|
||||
%{ /*
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 12 of "./test/err_syntax21.y", $0 is untyped
|
||||
YACC: e - line 12 of "./err_syntax21.y", $0 is untyped
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 17 of "./test/err_syntax22.y", $2 (recur) is untyped
|
||||
YACC: e - line 17 of "./err_syntax22.y", $2 (recur) is untyped
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 18 of "./test/err_syntax23.y", $$ is untyped
|
||||
YACC: e - line 18 of "./err_syntax23.y", $$ is untyped
|
||||
|
@ -1,2 +1,2 @@
|
||||
YACC: w - line 21 of "./test/err_syntax24.y", the default action assigns an undefined value to $$
|
||||
YACC: e - line 22 of "./test/err_syntax24.y", $$ is untyped
|
||||
YACC: w - line 21 of "./err_syntax24.y", the default action assigns an undefined value to $$
|
||||
YACC: e - line 22 of "./err_syntax24.y", $$ is untyped
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 11 of "./test/err_syntax25.y", too many %union declarations
|
||||
YACC: e - line 11 of "./err_syntax25.y", too many %union declarations
|
||||
%union {
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 6 of "./test/err_syntax26.y", unexpected end-of-file
|
||||
YACC: e - line 6 of "./err_syntax26.y", unexpected end-of-file
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 3 of "./test/err_syntax27.y", missing '}'
|
||||
YACC: e - line 3 of "./err_syntax27.y", missing '}'
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax3.y", unterminated string
|
||||
YACC: e - line 6 of "./err_syntax3.y", unterminated string
|
||||
%token <text> '(' '*' '&
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 1 of "./test/err_syntax4.y", unmatched %{
|
||||
YACC: e - line 1 of "./err_syntax4.y", unmatched %{
|
||||
%{
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax5.y", unterminated %union declaration
|
||||
YACC: e - line 6 of "./err_syntax5.y", unterminated %union declaration
|
||||
%union {
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax6.y", illegal tag
|
||||
YACC: e - line 6 of "./err_syntax6.y", illegal tag
|
||||
%token <text) '(' '*' '&
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax7.y", illegal character
|
||||
YACC: e - line 6 of "./err_syntax7.y", illegal character
|
||||
%token <text> '\777'
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax7a.y", illegal character
|
||||
YACC: e - line 6 of "./err_syntax7a.y", illegal character
|
||||
%token <text> '\xfff'
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax7b.y", illegal character
|
||||
YACC: e - line 6 of "./err_syntax7b.y", illegal character
|
||||
%token <text> '\x.'
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 6 of "./test/err_syntax8.y", illegal use of reserved symbol .
|
||||
YACC: e - line 6 of "./err_syntax8.y", illegal use of reserved symbol .
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 6 of "./test/err_syntax8a.y", illegal use of reserved symbol $$123
|
||||
YACC: e - line 6 of "./err_syntax8a.y", illegal use of reserved symbol $$123
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 7 of "./test/err_syntax9.y", the start symbol text cannot be declared to be a token
|
||||
YACC: e - line 7 of "./err_syntax9.y", the start symbol text cannot be declared to be a token
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -1,7 +1,9 @@
|
||||
#!/bin/sh
|
||||
# $Id: run_test.sh,v 1.22 2014/04/09 11:00:45 tom Exp $
|
||||
# $Id: run_test.sh,v 1.24 2014/07/15 19:21:10 tom Exp $
|
||||
# vi:ts=4 sw=4:
|
||||
|
||||
errors=0
|
||||
|
||||
# NEW is the file created by the testcase
|
||||
# REF is the reference file against which to compare
|
||||
test_diffs() {
|
||||
@ -11,13 +13,15 @@ test_diffs() {
|
||||
if test ! -f $CMP
|
||||
then
|
||||
echo "...not found $CMP"
|
||||
errors=1
|
||||
else
|
||||
sed -e s,$NEW,$REF, \
|
||||
-e "s%$YACC%YACC%" \
|
||||
-e "s%$YACC_escaped%YACC%" \
|
||||
-e '/YYPATCH/s/[0-9][0-9]*/"yyyymmdd"/' \
|
||||
-e '/#define YYPATCH/s/PATCH/CHECK/' \
|
||||
-e 's,#line \([1-9][0-9]*\) "'$REF_DIR'/,#line \1 ",' \
|
||||
-e 's,#line \([1-9][0-9]*\) "'$TEST_DIR'/,#line \1 ",' \
|
||||
-e 's,\(YACC:.* line [0-9][0-9]* of "\)'$TEST_DIR/',\1./,' \
|
||||
< $CMP >$tmpfile \
|
||||
&& mv $tmpfile $CMP
|
||||
if test ! -f $REF
|
||||
@ -31,6 +35,7 @@ test_diffs() {
|
||||
else
|
||||
echo "...diff $REF"
|
||||
diff -u $REF $CMP
|
||||
errors=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -62,10 +67,11 @@ else
|
||||
fi
|
||||
|
||||
YACC=$PROG_DIR/yacc
|
||||
YACC_escaped=`echo "$PROG_DIR/yacc" | sed -e 's/\./\\\./g'`
|
||||
|
||||
tmpfile=temp$$
|
||||
|
||||
ifBTYACC=`fgrep -l 'define YYBTYACC' config.h > /dev/null; test $? != 0; echo $?`
|
||||
ifBTYACC=`fgrep -l 'define YYBTYACC' $PROG_DIR/config.h > /dev/null; test $? != 0; echo $?`
|
||||
|
||||
if test $ifBTYACC = 0; then
|
||||
REF_DIR=${TEST_DIR}/yacc
|
||||
@ -236,3 +242,5 @@ do
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit $errors
|
||||
|
@ -5,7 +5,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -5,7 +5,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 1 of "./test/err_syntax1.y", syntax error
|
||||
YACC: e - line 1 of "./err_syntax1.y", syntax error
|
||||
?% {
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: w - line 7 of "./test/err_syntax10.y", the type of '(' has been redeclared
|
||||
YACC: w - line 7 of "./test/err_syntax10.y", the type of '*' has been redeclared
|
||||
YACC: w - line 7 of "./test/err_syntax10.y", the type of '&' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax10.y", the type of '(' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax10.y", the type of '*' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax10.y", the type of '&' has been redeclared
|
||||
|
@ -1 +1 @@
|
||||
YACC: w - line 7 of "./test/err_syntax11.y", the precedence of '|' has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax11.y", the precedence of '|' has been redeclared
|
||||
|
@ -1 +1 @@
|
||||
YACC: w - line 7 of "./test/err_syntax12.y", the value of text has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax12.y", the value of text has been redeclared
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 7 of "./test/err_syntax13.y", the start symbol text is a token
|
||||
YACC: e - line 7 of "./err_syntax13.y", the start symbol text is a token
|
||||
|
@ -1,2 +1,2 @@
|
||||
YACC: w - line 7 of "./test/err_syntax14.y", the start symbol has been redeclared
|
||||
YACC: w - line 7 of "./err_syntax14.y", the start symbol has been redeclared
|
||||
YACC: e - the start symbol text2 is undefined
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 9 of "./test/err_syntax15.y", no grammar has been specified
|
||||
YACC: e - line 9 of "./err_syntax15.y", no grammar has been specified
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 14 of "./test/err_syntax16.y", a token appears on the lhs of a production
|
||||
YACC: e - line 14 of "./err_syntax16.y", a token appears on the lhs of a production
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 8 of "./test/err_syntax17.y", unterminated action
|
||||
YACC: e - line 8 of "./err_syntax17.y", unterminated action
|
||||
S: { error
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: w - line 9 of "./test/err_syntax18.y", $4 references beyond the end of the current rule
|
||||
YACC: w - line 9 of "./err_syntax18.y", $4 references beyond the end of the current rule
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 9 of "./test/err_syntax19.y", illegal $-name
|
||||
YACC: e - line 9 of "./err_syntax19.y", illegal $-name
|
||||
{ $$ = $<oops>; }
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 1 of "./test/err_syntax2.y", unmatched /*
|
||||
YACC: e - line 1 of "./err_syntax2.y", unmatched /*
|
||||
%{ /*
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 12 of "./test/err_syntax21.y", $0 is untyped
|
||||
YACC: e - line 12 of "./err_syntax21.y", $0 is untyped
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 17 of "./test/err_syntax22.y", $2 (recur) is untyped
|
||||
YACC: e - line 17 of "./err_syntax22.y", $2 (recur) is untyped
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 18 of "./test/err_syntax23.y", $$ is untyped
|
||||
YACC: e - line 18 of "./err_syntax23.y", $$ is untyped
|
||||
|
@ -1,2 +1,2 @@
|
||||
YACC: w - line 21 of "./test/err_syntax24.y", the default action assigns an undefined value to $$
|
||||
YACC: e - line 22 of "./test/err_syntax24.y", $$ is untyped
|
||||
YACC: w - line 21 of "./err_syntax24.y", the default action assigns an undefined value to $$
|
||||
YACC: e - line 22 of "./err_syntax24.y", $$ is untyped
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 11 of "./test/err_syntax25.y", too many %union declarations
|
||||
YACC: e - line 11 of "./err_syntax25.y", too many %union declarations
|
||||
%union {
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 6 of "./test/err_syntax26.y", unexpected end-of-file
|
||||
YACC: e - line 6 of "./err_syntax26.y", unexpected end-of-file
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 3 of "./test/err_syntax27.y", missing '}'
|
||||
YACC: e - line 3 of "./err_syntax27.y", missing '}'
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax3.y", unterminated string
|
||||
YACC: e - line 6 of "./err_syntax3.y", unterminated string
|
||||
%token <text> '(' '*' '&
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 1 of "./test/err_syntax4.y", unmatched %{
|
||||
YACC: e - line 1 of "./err_syntax4.y", unmatched %{
|
||||
%{
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax5.y", unterminated %union declaration
|
||||
YACC: e - line 6 of "./err_syntax5.y", unterminated %union declaration
|
||||
%union {
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax6.y", illegal tag
|
||||
YACC: e - line 6 of "./err_syntax6.y", illegal tag
|
||||
%token <text) '(' '*' '&
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax7.y", illegal character
|
||||
YACC: e - line 6 of "./err_syntax7.y", illegal character
|
||||
%token <text> '\777'
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax7a.y", illegal character
|
||||
YACC: e - line 6 of "./err_syntax7a.y", illegal character
|
||||
%token <text> '\xfff'
|
||||
^
|
||||
|
@ -1,3 +1,3 @@
|
||||
YACC: e - line 6 of "./test/err_syntax7b.y", illegal character
|
||||
YACC: e - line 6 of "./err_syntax7b.y", illegal character
|
||||
%token <text> '\x.'
|
||||
^
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 6 of "./test/err_syntax8.y", illegal use of reserved symbol .
|
||||
YACC: e - line 6 of "./err_syntax8.y", illegal use of reserved symbol .
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 6 of "./test/err_syntax8a.y", illegal use of reserved symbol $$123
|
||||
YACC: e - line 6 of "./err_syntax8a.y", illegal use of reserved symbol $$123
|
||||
|
@ -1 +1 @@
|
||||
YACC: e - line 7 of "./test/err_syntax9.y", the start symbol text cannot be declared to be a token
|
||||
YACC: e - line 7 of "./err_syntax9.y", the start symbol text cannot be declared to be a token
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -4,7 +4,6 @@ Options:
|
||||
-b file_prefix set filename prefix (default "y.")
|
||||
-B create a backtracking parser
|
||||
-d write definitions (.tab.h)
|
||||
-D enable value stack memory reclamation
|
||||
-i write interface (y.tab.i)
|
||||
-g write a graphical description
|
||||
-l suppress #line directives
|
||||
|
@ -1,41 +1,334 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TEST_DIR= ${.CURDIR}/../../../contrib/byacc/test
|
||||
|
||||
.PATH: ${TEST_DIR} ${TEST_DIR}/yacc
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.bin/yacc
|
||||
|
||||
TAP_TESTS_SH= legacy_test
|
||||
PLAIN_TESTS_SH= yacc_tests
|
||||
|
||||
FILESDIR= ${TESTSDIR}
|
||||
FILES= calc.y
|
||||
FILES+= calc1.y
|
||||
FILES+= calc2.y
|
||||
FILES+= calc3.y
|
||||
FILES+= code_calc.y
|
||||
FILES+= code_error.y
|
||||
FILES+= error.y
|
||||
FILES+= ftp.y
|
||||
FILES+= grammar.y
|
||||
FILES+= pure_calc.y
|
||||
FILES+= pure_error.y
|
||||
FILES+= quote_calc.y
|
||||
FILES+= quote_calc2.y
|
||||
FILES+= quote_calc3.y
|
||||
FILES+= quote_calc4.y
|
||||
FILES+= regress.00.out
|
||||
FILES+= regress.01.out
|
||||
FILES+= regress.02.out
|
||||
FILES+= regress.03.out
|
||||
FILES+= regress.04.out
|
||||
FILES+= regress.05.out
|
||||
FILES+= regress.06.out
|
||||
FILES+= regress.07.out
|
||||
FILES+= regress.08.out
|
||||
FILES+= regress.09.out
|
||||
FILES+= regress.10.out
|
||||
FILES+= regress.11.out
|
||||
FILES+= regress.12.out
|
||||
FILES+= regress.13.out
|
||||
FILES+= regress.14.out
|
||||
FILES+= regress.sh
|
||||
FILES+= undefined.y
|
||||
SCRIPTS= run_test
|
||||
SCRIPTSDIR= ${TESTSDIR}
|
||||
|
||||
FILESGROUPS= FILEStest FILEStest_yacc
|
||||
|
||||
FILEStestDIR= ${TESTSDIR}
|
||||
|
||||
FILEStest+= btyacc_calc1.y
|
||||
FILEStest+= btyacc_demo.y
|
||||
FILEStest+= calc.y
|
||||
FILEStest+= calc1.y
|
||||
FILEStest+= calc2.y
|
||||
FILEStest+= calc3.y
|
||||
FILEStest+= code_calc.y
|
||||
FILEStest+= code_debug.y
|
||||
FILEStest+= code_error.y
|
||||
FILEStest+= empty.y
|
||||
FILEStest+= err_inherit1.y
|
||||
FILEStest+= err_inherit2.y
|
||||
FILEStest+= err_inherit3.y
|
||||
FILEStest+= err_inherit4.y
|
||||
FILEStest+= err_inherit5.y
|
||||
FILEStest+= err_syntax1.y
|
||||
FILEStest+= err_syntax10.y
|
||||
FILEStest+= err_syntax11.y
|
||||
FILEStest+= err_syntax12.y
|
||||
FILEStest+= err_syntax13.y
|
||||
FILEStest+= err_syntax14.y
|
||||
FILEStest+= err_syntax15.y
|
||||
FILEStest+= err_syntax16.y
|
||||
FILEStest+= err_syntax17.y
|
||||
FILEStest+= err_syntax18.y
|
||||
FILEStest+= err_syntax19.y
|
||||
FILEStest+= err_syntax2.y
|
||||
FILEStest+= err_syntax20.y
|
||||
FILEStest+= err_syntax21.y
|
||||
FILEStest+= err_syntax22.y
|
||||
FILEStest+= err_syntax23.y
|
||||
FILEStest+= err_syntax24.y
|
||||
FILEStest+= err_syntax25.y
|
||||
FILEStest+= err_syntax26.y
|
||||
FILEStest+= err_syntax27.y
|
||||
FILEStest+= err_syntax3.y
|
||||
FILEStest+= err_syntax4.y
|
||||
FILEStest+= err_syntax5.y
|
||||
FILEStest+= err_syntax6.y
|
||||
FILEStest+= err_syntax7.y
|
||||
FILEStest+= err_syntax7a.y
|
||||
FILEStest+= err_syntax7b.y
|
||||
FILEStest+= err_syntax8.y
|
||||
FILEStest+= err_syntax8a.y
|
||||
FILEStest+= err_syntax9.y
|
||||
FILEStest+= error.y
|
||||
FILEStest+= grammar.y
|
||||
FILEStest+= inherit0.y
|
||||
FILEStest+= inherit1.y
|
||||
FILEStest+= inherit2.y
|
||||
FILEStest+= ok_syntax1.y
|
||||
FILEStest+= pure_calc.y
|
||||
FILEStest+= pure_error.y
|
||||
FILEStest+= quote_calc.y
|
||||
FILEStest+= quote_calc2.y
|
||||
FILEStest+= quote_calc3.y
|
||||
FILEStest+= quote_calc4.y
|
||||
FILEStest+= varsyntax_calc1.y
|
||||
|
||||
FILEStest_yaccDIR= ${TESTSDIR}/yacc
|
||||
|
||||
FILEStest_yacc+= big_b.error
|
||||
FILEStest_yacc+= big_b.output
|
||||
FILEStest_yacc+= big_l.error
|
||||
FILEStest_yacc+= big_l.output
|
||||
FILEStest_yacc+= calc.error
|
||||
FILEStest_yacc+= calc.output
|
||||
FILEStest_yacc+= calc.tab.c
|
||||
FILEStest_yacc+= calc.tab.h
|
||||
FILEStest_yacc+= calc1.error
|
||||
FILEStest_yacc+= calc1.output
|
||||
FILEStest_yacc+= calc1.tab.c
|
||||
FILEStest_yacc+= calc1.tab.h
|
||||
FILEStest_yacc+= calc2.error
|
||||
FILEStest_yacc+= calc2.output
|
||||
FILEStest_yacc+= calc2.tab.c
|
||||
FILEStest_yacc+= calc2.tab.h
|
||||
FILEStest_yacc+= calc3.error
|
||||
FILEStest_yacc+= calc3.output
|
||||
FILEStest_yacc+= calc3.tab.c
|
||||
FILEStest_yacc+= calc3.tab.h
|
||||
FILEStest_yacc+= code_calc.code.c
|
||||
FILEStest_yacc+= code_calc.error
|
||||
FILEStest_yacc+= code_calc.output
|
||||
FILEStest_yacc+= code_calc.tab.c
|
||||
FILEStest_yacc+= code_calc.tab.h
|
||||
FILEStest_yacc+= code_error.code.c
|
||||
FILEStest_yacc+= code_error.error
|
||||
FILEStest_yacc+= code_error.output
|
||||
FILEStest_yacc+= code_error.tab.c
|
||||
FILEStest_yacc+= code_error.tab.h
|
||||
FILEStest_yacc+= empty.error
|
||||
FILEStest_yacc+= empty.output
|
||||
FILEStest_yacc+= empty.tab.c
|
||||
FILEStest_yacc+= empty.tab.h
|
||||
FILEStest_yacc+= err_syntax1.error
|
||||
FILEStest_yacc+= err_syntax1.output
|
||||
FILEStest_yacc+= err_syntax1.tab.c
|
||||
FILEStest_yacc+= err_syntax1.tab.h
|
||||
FILEStest_yacc+= err_syntax10.error
|
||||
FILEStest_yacc+= err_syntax10.output
|
||||
FILEStest_yacc+= err_syntax10.tab.c
|
||||
FILEStest_yacc+= err_syntax10.tab.h
|
||||
FILEStest_yacc+= err_syntax11.error
|
||||
FILEStest_yacc+= err_syntax11.output
|
||||
FILEStest_yacc+= err_syntax11.tab.c
|
||||
FILEStest_yacc+= err_syntax11.tab.h
|
||||
FILEStest_yacc+= err_syntax12.error
|
||||
FILEStest_yacc+= err_syntax12.output
|
||||
FILEStest_yacc+= err_syntax12.tab.c
|
||||
FILEStest_yacc+= err_syntax12.tab.h
|
||||
FILEStest_yacc+= err_syntax13.error
|
||||
FILEStest_yacc+= err_syntax13.output
|
||||
FILEStest_yacc+= err_syntax13.tab.c
|
||||
FILEStest_yacc+= err_syntax13.tab.h
|
||||
FILEStest_yacc+= err_syntax14.error
|
||||
FILEStest_yacc+= err_syntax14.output
|
||||
FILEStest_yacc+= err_syntax14.tab.c
|
||||
FILEStest_yacc+= err_syntax14.tab.h
|
||||
FILEStest_yacc+= err_syntax15.error
|
||||
FILEStest_yacc+= err_syntax15.output
|
||||
FILEStest_yacc+= err_syntax15.tab.c
|
||||
FILEStest_yacc+= err_syntax15.tab.h
|
||||
FILEStest_yacc+= err_syntax16.error
|
||||
FILEStest_yacc+= err_syntax16.output
|
||||
FILEStest_yacc+= err_syntax16.tab.c
|
||||
FILEStest_yacc+= err_syntax16.tab.h
|
||||
FILEStest_yacc+= err_syntax17.error
|
||||
FILEStest_yacc+= err_syntax17.output
|
||||
FILEStest_yacc+= err_syntax17.tab.c
|
||||
FILEStest_yacc+= err_syntax17.tab.h
|
||||
FILEStest_yacc+= err_syntax18.error
|
||||
FILEStest_yacc+= err_syntax18.output
|
||||
FILEStest_yacc+= err_syntax18.tab.c
|
||||
FILEStest_yacc+= err_syntax18.tab.h
|
||||
FILEStest_yacc+= err_syntax19.error
|
||||
FILEStest_yacc+= err_syntax19.output
|
||||
FILEStest_yacc+= err_syntax19.tab.c
|
||||
FILEStest_yacc+= err_syntax19.tab.h
|
||||
FILEStest_yacc+= err_syntax2.error
|
||||
FILEStest_yacc+= err_syntax2.output
|
||||
FILEStest_yacc+= err_syntax2.tab.c
|
||||
FILEStest_yacc+= err_syntax2.tab.h
|
||||
FILEStest_yacc+= err_syntax20.error
|
||||
FILEStest_yacc+= err_syntax20.output
|
||||
FILEStest_yacc+= err_syntax20.tab.c
|
||||
FILEStest_yacc+= err_syntax20.tab.h
|
||||
FILEStest_yacc+= err_syntax21.error
|
||||
FILEStest_yacc+= err_syntax21.output
|
||||
FILEStest_yacc+= err_syntax21.tab.c
|
||||
FILEStest_yacc+= err_syntax21.tab.h
|
||||
FILEStest_yacc+= err_syntax22.error
|
||||
FILEStest_yacc+= err_syntax22.output
|
||||
FILEStest_yacc+= err_syntax22.tab.c
|
||||
FILEStest_yacc+= err_syntax22.tab.h
|
||||
FILEStest_yacc+= err_syntax23.error
|
||||
FILEStest_yacc+= err_syntax23.output
|
||||
FILEStest_yacc+= err_syntax23.tab.c
|
||||
FILEStest_yacc+= err_syntax23.tab.h
|
||||
FILEStest_yacc+= err_syntax24.error
|
||||
FILEStest_yacc+= err_syntax24.output
|
||||
FILEStest_yacc+= err_syntax24.tab.c
|
||||
FILEStest_yacc+= err_syntax24.tab.h
|
||||
FILEStest_yacc+= err_syntax25.error
|
||||
FILEStest_yacc+= err_syntax25.output
|
||||
FILEStest_yacc+= err_syntax25.tab.c
|
||||
FILEStest_yacc+= err_syntax25.tab.h
|
||||
FILEStest_yacc+= err_syntax26.error
|
||||
FILEStest_yacc+= err_syntax26.output
|
||||
FILEStest_yacc+= err_syntax26.tab.c
|
||||
FILEStest_yacc+= err_syntax26.tab.h
|
||||
FILEStest_yacc+= err_syntax27.error
|
||||
FILEStest_yacc+= err_syntax27.output
|
||||
FILEStest_yacc+= err_syntax27.tab.c
|
||||
FILEStest_yacc+= err_syntax27.tab.h
|
||||
FILEStest_yacc+= err_syntax3.error
|
||||
FILEStest_yacc+= err_syntax3.output
|
||||
FILEStest_yacc+= err_syntax3.tab.c
|
||||
FILEStest_yacc+= err_syntax3.tab.h
|
||||
FILEStest_yacc+= err_syntax4.error
|
||||
FILEStest_yacc+= err_syntax4.output
|
||||
FILEStest_yacc+= err_syntax4.tab.c
|
||||
FILEStest_yacc+= err_syntax4.tab.h
|
||||
FILEStest_yacc+= err_syntax5.error
|
||||
FILEStest_yacc+= err_syntax5.output
|
||||
FILEStest_yacc+= err_syntax5.tab.c
|
||||
FILEStest_yacc+= err_syntax5.tab.h
|
||||
FILEStest_yacc+= err_syntax6.error
|
||||
FILEStest_yacc+= err_syntax6.output
|
||||
FILEStest_yacc+= err_syntax6.tab.c
|
||||
FILEStest_yacc+= err_syntax6.tab.h
|
||||
FILEStest_yacc+= err_syntax7.error
|
||||
FILEStest_yacc+= err_syntax7.output
|
||||
FILEStest_yacc+= err_syntax7.tab.c
|
||||
FILEStest_yacc+= err_syntax7.tab.h
|
||||
FILEStest_yacc+= err_syntax7a.error
|
||||
FILEStest_yacc+= err_syntax7a.output
|
||||
FILEStest_yacc+= err_syntax7a.tab.c
|
||||
FILEStest_yacc+= err_syntax7a.tab.h
|
||||
FILEStest_yacc+= err_syntax7b.error
|
||||
FILEStest_yacc+= err_syntax7b.output
|
||||
FILEStest_yacc+= err_syntax7b.tab.c
|
||||
FILEStest_yacc+= err_syntax7b.tab.h
|
||||
FILEStest_yacc+= err_syntax8.error
|
||||
FILEStest_yacc+= err_syntax8.output
|
||||
FILEStest_yacc+= err_syntax8.tab.c
|
||||
FILEStest_yacc+= err_syntax8.tab.h
|
||||
FILEStest_yacc+= err_syntax8a.error
|
||||
FILEStest_yacc+= err_syntax8a.output
|
||||
FILEStest_yacc+= err_syntax8a.tab.c
|
||||
FILEStest_yacc+= err_syntax8a.tab.h
|
||||
FILEStest_yacc+= err_syntax9.error
|
||||
FILEStest_yacc+= err_syntax9.output
|
||||
FILEStest_yacc+= err_syntax9.tab.c
|
||||
FILEStest_yacc+= err_syntax9.tab.h
|
||||
FILEStest_yacc+= error.error
|
||||
FILEStest_yacc+= error.output
|
||||
FILEStest_yacc+= error.tab.c
|
||||
FILEStest_yacc+= error.tab.h
|
||||
FILEStest_yacc+= grammar.dot
|
||||
FILEStest_yacc+= grammar.error
|
||||
FILEStest_yacc+= grammar.output
|
||||
FILEStest_yacc+= grammar.tab.c
|
||||
FILEStest_yacc+= grammar.tab.h
|
||||
FILEStest_yacc+= help.error
|
||||
FILEStest_yacc+= help.output
|
||||
FILEStest_yacc+= no_b_opt.error
|
||||
FILEStest_yacc+= no_b_opt.output
|
||||
# XXX: expected: `f - cannot open "nosuchfile.c"; gets
|
||||
# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
|
||||
#FILEStest_yacc+= no_b_opt1.error
|
||||
#FILEStest_yacc+= no_b_opt1.output
|
||||
#FILEStest_yacc+= no_code_c.error
|
||||
#FILEStest_yacc+= no_code_c.output
|
||||
#FILEStest_yacc+= no_defines.error
|
||||
#FILEStest_yacc+= no_defines.output
|
||||
#FILEStest_yacc+= no_graph.error
|
||||
#FILEStest_yacc+= no_graph.output
|
||||
#FILEStest_yacc+= no_include.error
|
||||
#FILEStest_yacc+= no_include.output
|
||||
FILEStest_yacc+= no_opts.error
|
||||
FILEStest_yacc+= no_opts.output
|
||||
# XXX: expected: `f - cannot open "nosuchfile.c"; gets
|
||||
# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
|
||||
#FILEStest_yacc+= no_output.error
|
||||
#FILEStest_yacc+= no_output.output
|
||||
#FILEStest_yacc+= no_output1.error
|
||||
#FILEStest_yacc+= no_output1.output
|
||||
FILEStest_yacc+= no_output2.error
|
||||
FILEStest_yacc+= no_output2.output
|
||||
FILEStest_yacc+= no_p_opt.error
|
||||
FILEStest_yacc+= no_p_opt.output
|
||||
# XXX: expected: `f - cannot open "nosuchfile.c"; gets
|
||||
# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
|
||||
#FILEStest_yacc+= no_p_opt1.error
|
||||
#FILEStest_yacc+= no_p_opt1.output
|
||||
#FILEStest_yacc+= no_verbose.error
|
||||
#FILEStest_yacc+= no_verbose.output
|
||||
FILEStest_yacc+= nostdin.error
|
||||
FILEStest_yacc+= nostdin.output
|
||||
FILEStest_yacc+= ok_syntax1.error
|
||||
FILEStest_yacc+= ok_syntax1.output
|
||||
FILEStest_yacc+= ok_syntax1.tab.c
|
||||
FILEStest_yacc+= ok_syntax1.tab.h
|
||||
FILEStest_yacc+= pure_calc.error
|
||||
FILEStest_yacc+= pure_calc.output
|
||||
FILEStest_yacc+= pure_calc.tab.c
|
||||
FILEStest_yacc+= pure_calc.tab.h
|
||||
FILEStest_yacc+= pure_error.error
|
||||
FILEStest_yacc+= pure_error.output
|
||||
FILEStest_yacc+= pure_error.tab.c
|
||||
FILEStest_yacc+= pure_error.tab.h
|
||||
FILEStest_yacc+= quote_calc-s.error
|
||||
FILEStest_yacc+= quote_calc-s.output
|
||||
FILEStest_yacc+= quote_calc-s.tab.c
|
||||
FILEStest_yacc+= quote_calc-s.tab.h
|
||||
FILEStest_yacc+= quote_calc.error
|
||||
FILEStest_yacc+= quote_calc.output
|
||||
FILEStest_yacc+= quote_calc.tab.c
|
||||
FILEStest_yacc+= quote_calc.tab.h
|
||||
FILEStest_yacc+= quote_calc2-s.error
|
||||
FILEStest_yacc+= quote_calc2-s.output
|
||||
FILEStest_yacc+= quote_calc2-s.tab.c
|
||||
FILEStest_yacc+= quote_calc2-s.tab.h
|
||||
FILEStest_yacc+= quote_calc2.error
|
||||
FILEStest_yacc+= quote_calc2.output
|
||||
FILEStest_yacc+= quote_calc2.tab.c
|
||||
FILEStest_yacc+= quote_calc2.tab.h
|
||||
FILEStest_yacc+= quote_calc3-s.error
|
||||
FILEStest_yacc+= quote_calc3-s.output
|
||||
FILEStest_yacc+= quote_calc3-s.tab.c
|
||||
FILEStest_yacc+= quote_calc3-s.tab.h
|
||||
FILEStest_yacc+= quote_calc3.error
|
||||
FILEStest_yacc+= quote_calc3.output
|
||||
FILEStest_yacc+= quote_calc3.tab.c
|
||||
FILEStest_yacc+= quote_calc3.tab.h
|
||||
FILEStest_yacc+= quote_calc4-s.error
|
||||
FILEStest_yacc+= quote_calc4-s.output
|
||||
FILEStest_yacc+= quote_calc4-s.tab.c
|
||||
FILEStest_yacc+= quote_calc4-s.tab.h
|
||||
FILEStest_yacc+= quote_calc4.error
|
||||
FILEStest_yacc+= quote_calc4.output
|
||||
FILEStest_yacc+= quote_calc4.tab.c
|
||||
FILEStest_yacc+= quote_calc4.tab.h
|
||||
FILEStest_yacc+= rename_debug.c
|
||||
FILEStest_yacc+= rename_debug.error
|
||||
FILEStest_yacc+= rename_debug.h
|
||||
FILEStest_yacc+= rename_debug.i
|
||||
FILEStest_yacc+= rename_debug.output
|
||||
FILEStest_yacc+= varsyntax_calc1.error
|
||||
FILEStest_yacc+= varsyntax_calc1.output
|
||||
FILEStest_yacc+= varsyntax_calc1.tab.c
|
||||
FILEStest_yacc+= varsyntax_calc1.tab.h
|
||||
|
||||
.include <bsd.test.mk>
|
||||
|
@ -1,106 +0,0 @@
|
||||
%{
|
||||
# include <stdio.h>
|
||||
# include <ctype.h>
|
||||
|
||||
int regs[26];
|
||||
int base;
|
||||
|
||||
extern int yylex(void);
|
||||
static void yyerror(const char *s);
|
||||
|
||||
%}
|
||||
|
||||
%start list
|
||||
|
||||
%token DIGIT LETTER
|
||||
|
||||
%left '|'
|
||||
%left '&'
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%left UMINUS /* supplies precedence for unary minus */
|
||||
|
||||
%% /* beginning of rules section */
|
||||
|
||||
list : /* empty */
|
||||
| list stat '\n'
|
||||
| list error '\n'
|
||||
{ yyerrok ; }
|
||||
;
|
||||
|
||||
stat : expr
|
||||
{ printf("%d\n",$1);}
|
||||
| LETTER '=' expr
|
||||
{ regs[$1] = $3; }
|
||||
;
|
||||
|
||||
expr : '(' expr ')'
|
||||
{ $$ = $2; }
|
||||
| expr '+' expr
|
||||
{ $$ = $1 + $3; }
|
||||
| expr '-' expr
|
||||
{ $$ = $1 - $3; }
|
||||
| expr '*' expr
|
||||
{ $$ = $1 * $3; }
|
||||
| expr '/' expr
|
||||
{ $$ = $1 / $3; }
|
||||
| expr '%' expr
|
||||
{ $$ = $1 % $3; }
|
||||
| expr '&' expr
|
||||
{ $$ = $1 & $3; }
|
||||
| expr '|' expr
|
||||
{ $$ = $1 | $3; }
|
||||
| '-' expr %prec UMINUS
|
||||
{ $$ = - $2; }
|
||||
| LETTER
|
||||
{ $$ = regs[$1]; }
|
||||
| number
|
||||
;
|
||||
|
||||
number: DIGIT
|
||||
{ $$ = $1; base = ($1==0) ? 8 : 10; }
|
||||
| number DIGIT
|
||||
{ $$ = base * $1 + $2; }
|
||||
;
|
||||
|
||||
%% /* start of programs */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
while(!feof(stdin)) {
|
||||
yyparse();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
yyerror(const char *s)
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
int
|
||||
yylex(void)
|
||||
{
|
||||
/* lexical analysis routine */
|
||||
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
|
||||
/* return DIGIT for a digit, yylval = 0 through 9 */
|
||||
/* all other characters are returned immediately */
|
||||
|
||||
int c;
|
||||
|
||||
while( (c=getchar()) == ' ' ) { /* skip blanks */ }
|
||||
|
||||
/* c is now nonblank */
|
||||
|
||||
if( islower( c )) {
|
||||
yylval = c - 'a';
|
||||
return ( LETTER );
|
||||
}
|
||||
if( isdigit( c )) {
|
||||
yylval = c - '0';
|
||||
return ( DIGIT );
|
||||
}
|
||||
return( c );
|
||||
}
|
@ -1,305 +0,0 @@
|
||||
%{
|
||||
|
||||
/* http://dinosaur.compilertools.net/yacc/index.html */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef struct interval
|
||||
{
|
||||
double lo, hi;
|
||||
}
|
||||
INTERVAL;
|
||||
|
||||
INTERVAL vmul(double, double, INTERVAL);
|
||||
INTERVAL vdiv(double, double, INTERVAL);
|
||||
|
||||
extern int yylex(void);
|
||||
static void yyerror(const char *s);
|
||||
|
||||
int dcheck(INTERVAL);
|
||||
|
||||
double dreg[26];
|
||||
INTERVAL vreg[26];
|
||||
|
||||
%}
|
||||
%expect 18
|
||||
|
||||
%start line
|
||||
%union
|
||||
{
|
||||
int ival;
|
||||
double dval;
|
||||
INTERVAL vval;
|
||||
}
|
||||
|
||||
%token <ival> DREG VREG /* indices into dreg, vreg arrays */
|
||||
%token <dval> CONST /* floating point constant */
|
||||
|
||||
%type <dval> dexp /* expression */
|
||||
%type <vval> vexp /* interval expression */
|
||||
|
||||
/* precedence information about the operators */
|
||||
|
||||
%left '+' '-'
|
||||
%left '*' '/'
|
||||
%left UMINUS /* precedence for unary minus */
|
||||
|
||||
%% /* beginning of rules section */
|
||||
|
||||
lines : /* empty */
|
||||
| lines line
|
||||
;
|
||||
|
||||
line : dexp '\n'
|
||||
{
|
||||
(void) printf("%15.8f\n", $1);
|
||||
}
|
||||
| vexp '\n'
|
||||
{
|
||||
(void) printf("(%15.8f, %15.8f)\n", $1.lo, $1.hi);
|
||||
}
|
||||
| DREG '=' dexp '\n'
|
||||
{
|
||||
dreg[$1] = $3;
|
||||
}
|
||||
| VREG '=' vexp '\n'
|
||||
{
|
||||
vreg[$1] = $3;
|
||||
}
|
||||
| error '\n'
|
||||
{
|
||||
yyerrok;
|
||||
}
|
||||
;
|
||||
|
||||
dexp : CONST
|
||||
| DREG
|
||||
{
|
||||
$$ = dreg[$1];
|
||||
}
|
||||
| dexp '+' dexp
|
||||
{
|
||||
$$ = $1 + $3;
|
||||
}
|
||||
| dexp '-' dexp
|
||||
{
|
||||
$$ = $1 - $3;
|
||||
}
|
||||
| dexp '*' dexp
|
||||
{
|
||||
$$ = $1 * $3;
|
||||
}
|
||||
| dexp '/' dexp
|
||||
{
|
||||
$$ = $1 / $3;
|
||||
}
|
||||
| '-' dexp %prec UMINUS
|
||||
{
|
||||
$$ = -$2;
|
||||
}
|
||||
| '(' dexp ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
vexp : dexp
|
||||
{
|
||||
$$.hi = $$.lo = $1;
|
||||
}
|
||||
| '(' dexp ',' dexp ')'
|
||||
{
|
||||
$$.lo = $2;
|
||||
$$.hi = $4;
|
||||
if ( $$.lo > $$.hi )
|
||||
{
|
||||
(void) printf("interval out of order\n");
|
||||
YYERROR;
|
||||
}
|
||||
}
|
||||
| VREG
|
||||
{
|
||||
$$ = vreg[$1];
|
||||
}
|
||||
| vexp '+' vexp
|
||||
{
|
||||
$$.hi = $1.hi + $3.hi;
|
||||
$$.lo = $1.lo + $3.lo;
|
||||
}
|
||||
| dexp '+' vexp
|
||||
{
|
||||
$$.hi = $1 + $3.hi;
|
||||
$$.lo = $1 + $3.lo;
|
||||
}
|
||||
| vexp '-' vexp
|
||||
{
|
||||
$$.hi = $1.hi - $3.lo;
|
||||
$$.lo = $1.lo - $3.hi;
|
||||
}
|
||||
| dexp '-' vexp
|
||||
{
|
||||
$$.hi = $1 - $3.lo;
|
||||
$$.lo = $1 - $3.hi;
|
||||
}
|
||||
| vexp '*' vexp
|
||||
{
|
||||
$$ = vmul( $1.lo, $1.hi, $3 );
|
||||
}
|
||||
| dexp '*' vexp
|
||||
{
|
||||
$$ = vmul ($1, $1, $3 );
|
||||
}
|
||||
| vexp '/' vexp
|
||||
{
|
||||
if (dcheck($3)) YYERROR;
|
||||
$$ = vdiv ( $1.lo, $1.hi, $3 );
|
||||
}
|
||||
| dexp '/' vexp
|
||||
{
|
||||
if (dcheck ( $3 )) YYERROR;
|
||||
$$ = vdiv ($1, $1, $3 );
|
||||
}
|
||||
| '-' vexp %prec UMINUS
|
||||
{
|
||||
$$.hi = -$2.lo;
|
||||
$$.lo = -$2.hi;
|
||||
}
|
||||
| '(' vexp ')'
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
%% /* beginning of subroutines section */
|
||||
|
||||
#define BSZ 50 /* buffer size for floating point numbers */
|
||||
|
||||
/* lexical analysis */
|
||||
|
||||
static void
|
||||
yyerror(const char *s)
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
int
|
||||
yylex(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
while ((c = getchar()) == ' ')
|
||||
{ /* skip over blanks */
|
||||
}
|
||||
|
||||
if (isupper(c))
|
||||
{
|
||||
yylval.ival = c - 'A';
|
||||
return (VREG);
|
||||
}
|
||||
if (islower(c))
|
||||
{
|
||||
yylval.ival = c - 'a';
|
||||
return (DREG);
|
||||
}
|
||||
|
||||
if (isdigit(c) || c == '.')
|
||||
{
|
||||
/* gobble up digits, points, exponents */
|
||||
char buf[BSZ + 1], *cp = buf;
|
||||
int dot = 0, expr = 0;
|
||||
|
||||
for (; (cp - buf) < BSZ; ++cp, c = getchar())
|
||||
{
|
||||
|
||||
*cp = c;
|
||||
if (isdigit(c))
|
||||
continue;
|
||||
if (c == '.')
|
||||
{
|
||||
if (dot++ || expr)
|
||||
return ('.'); /* will cause syntax error */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == 'e')
|
||||
{
|
||||
if (expr++)
|
||||
return ('e'); /* will cause syntax error */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* end of number */
|
||||
break;
|
||||
}
|
||||
*cp = '\0';
|
||||
|
||||
if ((cp - buf) >= BSZ)
|
||||
printf("constant too long: truncated\n");
|
||||
else
|
||||
ungetc(c, stdin); /* push back last char read */
|
||||
yylval.dval = atof(buf);
|
||||
return (CONST);
|
||||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
static INTERVAL
|
||||
hilo(double a, double b, double c, double d)
|
||||
{
|
||||
/* returns the smallest interval containing a, b, c, and d */
|
||||
/* used by *, / routines */
|
||||
INTERVAL v;
|
||||
|
||||
if (a > b)
|
||||
{
|
||||
v.hi = a;
|
||||
v.lo = b;
|
||||
}
|
||||
else
|
||||
{
|
||||
v.hi = b;
|
||||
v.lo = a;
|
||||
}
|
||||
|
||||
if (c > d)
|
||||
{
|
||||
if (c > v.hi)
|
||||
v.hi = c;
|
||||
if (d < v.lo)
|
||||
v.lo = d;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d > v.hi)
|
||||
v.hi = d;
|
||||
if (c < v.lo)
|
||||
v.lo = c;
|
||||
}
|
||||
return (v);
|
||||
}
|
||||
|
||||
INTERVAL
|
||||
vmul(double a, double b, INTERVAL v)
|
||||
{
|
||||
return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
|
||||
}
|
||||
|
||||
int
|
||||
dcheck(INTERVAL v)
|
||||
{
|
||||
if (v.hi >= 0. && v.lo <= 0.)
|
||||
{
|
||||
printf("divisor interval contains 0.\n");
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
INTERVAL
|
||||
vdiv(double a, double b, INTERVAL v)
|
||||
{
|
||||
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
%parse-param { int regs[26] }
|
||||
%parse-param { int *base }
|
||||
|
||||
%lex-param { int *base }
|
||||
|
||||
%{
|
||||
# include <stdio.h>
|
||||
# include <ctype.h>
|
||||
|
||||
#ifdef YYBISON
|
||||
#define YYLEX_PARAM base
|
||||
#define YYLEX_DECL() yylex(int *YYLEX_PARAM)
|
||||
#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
|
||||
int YYLEX_DECL();
|
||||
static void YYERROR_DECL();
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%start list
|
||||
|
||||
%token DIGIT LETTER
|
||||
|
||||
%left '|'
|
||||
%left '&'
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%left UMINUS /* supplies precedence for unary minus */
|
||||
|
||||
%% /* beginning of rules section */
|
||||
|
||||
list : /* empty */
|
||||
| list stat '\n'
|
||||
| list error '\n'
|
||||
{ yyerrok ; }
|
||||
;
|
||||
|
||||
stat : expr
|
||||
{ printf("%d\n",$1);}
|
||||
| LETTER '=' expr
|
||||
{ regs[$1] = $3; }
|
||||
;
|
||||
|
||||
expr : '(' expr ')'
|
||||
{ $$ = $2; }
|
||||
| expr '+' expr
|
||||
{ $$ = $1 + $3; }
|
||||
| expr '-' expr
|
||||
{ $$ = $1 - $3; }
|
||||
| expr '*' expr
|
||||
{ $$ = $1 * $3; }
|
||||
| expr '/' expr
|
||||
{ $$ = $1 / $3; }
|
||||
| expr '%' expr
|
||||
{ $$ = $1 % $3; }
|
||||
| expr '&' expr
|
||||
{ $$ = $1 & $3; }
|
||||
| expr '|' expr
|
||||
{ $$ = $1 | $3; }
|
||||
| '-' expr %prec UMINUS
|
||||
{ $$ = - $2; }
|
||||
| LETTER
|
||||
{ $$ = regs[$1]; }
|
||||
| number
|
||||
;
|
||||
|
||||
number: DIGIT
|
||||
{ $$ = $1; (*base) = ($1==0) ? 8 : 10; }
|
||||
| number DIGIT
|
||||
{ $$ = (*base) * $1 + $2; }
|
||||
;
|
||||
|
||||
%% /* start of programs */
|
||||
|
||||
#ifdef YYBYACC
|
||||
extern int YYLEX_DECL();
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int regs[26];
|
||||
int base = 10;
|
||||
|
||||
while(!feof(stdin)) {
|
||||
yyparse(regs, &base);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
YYERROR_DECL()
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
int
|
||||
YYLEX_DECL()
|
||||
{
|
||||
/* lexical analysis routine */
|
||||
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
|
||||
/* return DIGIT for a digit, yylval = 0 through 9 */
|
||||
/* all other characters are returned immediately */
|
||||
|
||||
int c;
|
||||
|
||||
while( (c=getchar()) == ' ' ) { /* skip blanks */ }
|
||||
|
||||
/* c is now nonblank */
|
||||
|
||||
if( islower( c )) {
|
||||
yylval = c - 'a';
|
||||
return ( LETTER );
|
||||
}
|
||||
if( isdigit( c )) {
|
||||
yylval = (c - '0') % (*base);
|
||||
return ( DIGIT );
|
||||
}
|
||||
return( c );
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
%pure-parser
|
||||
|
||||
%parse-param { int regs[26] }
|
||||
%parse-param { int *base }
|
||||
|
||||
%lex-param { int *base }
|
||||
|
||||
%{
|
||||
# include <stdio.h>
|
||||
# include <ctype.h>
|
||||
|
||||
#ifdef YYBISON
|
||||
#define YYSTYPE int
|
||||
#define YYLEX_PARAM base
|
||||
#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
|
||||
#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
|
||||
int YYLEX_DECL();
|
||||
static void YYERROR_DECL();
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%start list
|
||||
|
||||
%token DIGIT LETTER
|
||||
|
||||
%left '|'
|
||||
%left '&'
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%left UMINUS /* supplies precedence for unary minus */
|
||||
|
||||
%% /* beginning of rules section */
|
||||
|
||||
list : /* empty */
|
||||
| list stat '\n'
|
||||
| list error '\n'
|
||||
{ yyerrok ; }
|
||||
;
|
||||
|
||||
stat : expr
|
||||
{ printf("%d\n",$1);}
|
||||
| LETTER '=' expr
|
||||
{ regs[$1] = $3; }
|
||||
;
|
||||
|
||||
expr : '(' expr ')'
|
||||
{ $$ = $2; }
|
||||
| expr '+' expr
|
||||
{ $$ = $1 + $3; }
|
||||
| expr '-' expr
|
||||
{ $$ = $1 - $3; }
|
||||
| expr '*' expr
|
||||
{ $$ = $1 * $3; }
|
||||
| expr '/' expr
|
||||
{ $$ = $1 / $3; }
|
||||
| expr '%' expr
|
||||
{ $$ = $1 % $3; }
|
||||
| expr '&' expr
|
||||
{ $$ = $1 & $3; }
|
||||
| expr '|' expr
|
||||
{ $$ = $1 | $3; }
|
||||
| '-' expr %prec UMINUS
|
||||
{ $$ = - $2; }
|
||||
| LETTER
|
||||
{ $$ = regs[$1]; }
|
||||
| number
|
||||
;
|
||||
|
||||
number: DIGIT
|
||||
{ $$ = $1; (*base) = ($1==0) ? 8 : 10; }
|
||||
| number DIGIT
|
||||
{ $$ = (*base) * $1 + $2; }
|
||||
;
|
||||
|
||||
%% /* start of programs */
|
||||
|
||||
#ifdef YYBYACC
|
||||
extern int YYLEX_DECL();
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int regs[26];
|
||||
int base = 10;
|
||||
|
||||
while(!feof(stdin)) {
|
||||
yyparse(regs, &base);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
YYERROR_DECL()
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
int
|
||||
YYLEX_DECL()
|
||||
{
|
||||
/* lexical analysis routine */
|
||||
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
|
||||
/* return DIGIT for a digit, yylval = 0 through 9 */
|
||||
/* all other characters are returned immediately */
|
||||
|
||||
int c;
|
||||
|
||||
while( (c=getchar()) == ' ' ) { /* skip blanks */ }
|
||||
|
||||
/* c is now nonblank */
|
||||
|
||||
if( islower( c )) {
|
||||
*yylval = (c - 'a');
|
||||
return ( LETTER );
|
||||
}
|
||||
if( isdigit( c )) {
|
||||
*yylval = (c - '0') % (*base);
|
||||
return ( DIGIT );
|
||||
}
|
||||
return( c );
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
%{
|
||||
# include <stdio.h>
|
||||
# include <ctype.h>
|
||||
|
||||
int regs[26];
|
||||
int base;
|
||||
|
||||
#ifdef YYBISON
|
||||
int yylex(void);
|
||||
static void yyerror(const char *s);
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
%start list
|
||||
|
||||
%token DIGIT LETTER
|
||||
|
||||
%left '|'
|
||||
%left '&'
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%left UMINUS /* supplies precedence for unary minus */
|
||||
|
||||
%% /* beginning of rules section */
|
||||
|
||||
list : /* empty */
|
||||
| list stat '\n'
|
||||
| list error '\n'
|
||||
{ yyerrok ; }
|
||||
;
|
||||
|
||||
stat : expr
|
||||
{ printf("%d\n",$1);}
|
||||
| LETTER '=' expr
|
||||
{ regs[$1] = $3; }
|
||||
;
|
||||
|
||||
expr : '(' expr ')'
|
||||
{ $$ = $2; }
|
||||
| expr '+' expr
|
||||
{ $$ = $1 + $3; }
|
||||
| expr '-' expr
|
||||
{ $$ = $1 - $3; }
|
||||
| expr '*' expr
|
||||
{ $$ = $1 * $3; }
|
||||
| expr '/' expr
|
||||
{ $$ = $1 / $3; }
|
||||
| expr '%' expr
|
||||
{ $$ = $1 % $3; }
|
||||
| expr '&' expr
|
||||
{ $$ = $1 & $3; }
|
||||
| expr '|' expr
|
||||
{ $$ = $1 | $3; }
|
||||
| '-' expr %prec UMINUS
|
||||
{ $$ = - $2; }
|
||||
| LETTER
|
||||
{ $$ = regs[$1]; }
|
||||
| number
|
||||
;
|
||||
|
||||
number: DIGIT
|
||||
{ $$ = $1; base = ($1==0) ? 8 : 10; }
|
||||
| number DIGIT
|
||||
{ $$ = base * $1 + $2; }
|
||||
;
|
||||
|
||||
%% /* start of programs */
|
||||
|
||||
#ifdef YYBYACC
|
||||
extern int YYLEX_DECL();
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
while(!feof(stdin)) {
|
||||
yyparse();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
yyerror(const char *s)
|
||||
{
|
||||
fprintf(stderr, "%s\n", s);
|
||||
}
|
||||
|
||||
int
|
||||
yylex(void)
|
||||
{
|
||||
/* lexical analysis routine */
|
||||
/* returns LETTER for a lower case letter, yylval = 0 through 25 */
|
||||
/* return DIGIT for a digit, yylval = 0 through 9 */
|
||||
/* all other characters are returned immediately */
|
||||
|
||||
int c;
|
||||
|
||||
while( (c=getchar()) == ' ' ) { /* skip blanks */ }
|
||||
|
||||
/* c is now nonblank */
|
||||
|
||||
if( islower( c )) {
|
||||
yylval = c - 'a';
|
||||
return ( LETTER );
|
||||
}
|
||||
if( isdigit( c )) {
|
||||
yylval = c - '0';
|
||||
return ( DIGIT );
|
||||
}
|
||||
return( c );
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
%{
|
||||
|
||||
#ifdef YYBISON
|
||||
int yylex(void);
|
||||
static void yyerror(const char *);
|
||||
#endif
|
||||
|
||||
%}
|
||||
%%
|
||||
S: error
|
||||
%%
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef YYBYACC
|
||||
extern int YYLEX_DECL();
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("yyparse() = %d\n", yyparse());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
yylex(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
yyerror(const char* s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
%{
|
||||
int yylex(void);
|
||||
static void yyerror(const char *);
|
||||
%}
|
||||
%%
|
||||
S: error
|
||||
%%
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("yyparse() = %d\n", yyparse());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
yylex(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
yyerror(const char* s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $FreeBSD$
|
||||
|
||||
SRCDIR="$(dirname "${0}")"; export SRCDIR
|
||||
|
||||
m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user