⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 occs.par

📁 compiler
💻 PAR
📖 第 1 页 / 共 2 页
字号:
/*@A (C) 1992 Allen I. Holub                                                */

  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @ This section goes at the top of the file, before any user-supplied	@
  @ code is emitted. It is output regardless of the presence of -a or -p @
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

#include <stdio.h>
#include <stdarg.h>
#include <tools/yystack.h>					/* #pp */


#include <stdlib.h>	  /* Needed only for prototype for exit(). Can be  */
			  /* discarded in most non-ANSI systems.	   */

#include <tools/debug.h>  /* These includes are needed to get prototypes   */
#include <tools/l.h>	  /* for the ii_ and yy_ functions in l.lib        */
			  /* You can remove them if your compiler doesn't  */
			  /* require the prototypes. The UNIX and ANSI     */
			  /* macros in debug.h are also used here.	   */
			  /* The UNIX, ANSI, BCC, and P, macros in debug.h */
			  /* are also used here.			   */
			  /* Note that there's a nested include for 	   */
			  /* stdarg.h in  <tools/l.h>.			   */

FILE  *yycodeout = stdout ;		/* Output stream (code). */
FILE  *yybssout  = stdout ;		/* Output stream (bss ). */
FILE  *yydataout = stdout ;		/* Output stream (data). */
int   yylookahead ;			/* Lookahead token.      */

extern char *yytext;			/* Declared by lex in lexyy.c */
extern int  yylineno;
extern int  yyleng;

void	yycode	    P(( char *fmt, ...	));	/* Supplied below and */
void	yydata	    P(( char *fmt, ...	));	/* in yydebug.c       */
void	yybss 	    P(( char *fmt, ...	));
void 	yyerror     P(( char *fmt, ...  ));
void 	yycomment   P(( char *fmt, ...  ));
int	yy_nextoken P(( void		));


extern unsigned char *ii_ptext();	/* Lookback function used by lex  */
extern int  ii_plength() ;		/* in /src/compiler/lib/input.c.  */
extern int  ii_plineno() ;

#ifdef YYDEBUG			/* Define YYD here so that it can be used */
#   define YYD(x) x		/* in the user-supplied header.		  */
#else
#   define YYD(x) /* empty */
#endif

/*----------------------------------------------------------------------*/


  @
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @ User-supplied code from the header part of the input file goes here.  @
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @


#undef YYD			/* Redefine YYD in case YYDEBUG was defined  */
#ifdef YYDEBUG			/* explicitly in the header rather than with */
#   define YYD(x) x		/* a -D on the occs command line.	     */
#   define printf  yycode	/* Make printf() calls go to output window   */
#else
#   define YYD(x) /* empty */
#endif

#ifndef YYACCEPT
#    define YYACCEPT return(0)	/* Action taken when input is accepted.	     */
#endif

#ifndef YYABORT
#    define YYABORT return(1)	/* Action taken when input is rejected.	     */
#endif

#ifndef YYPRIVATE
#    define YYPRIVATE static	/* define to a null string to make public    */
#endif

#ifndef YYMAXERR
#    define YYMAXERR 25      	/* Abort after this many errors 	     */
#endif

#ifndef YYMAXDEPTH           	/* State and value stack depth  	     */
#    define YYMAXDEPTH 128
#endif

#ifndef YYCASCADE           	/* Suppress error msgs. for this many cycles */
#    define YYCASCADE 5
#endif

#ifndef YYSTYPE		     	/* Default value stack type 		     */
#    define YYSTYPE int
#endif
				/* Default shift action: inherit $$  	*/
#ifndef YYSHIFTACT
#    define YYSHIFTACT(tos)  ( (tos)[0] = yylval )

#endif

#ifdef YYVERBOSE
#    define YYV(x) x
#else
#    define YYV(x)
#endif

#undef  yystk_cls			/* redefine stack macros for local */
#define yystk_cls YYPRIVATE		/* use.				   */

/* ----------------------------------------------------------------------
 * #defines used in the tables. Note that the parsing algorithm assumes that
 * the start state is State 0. Consequently, since the start state is shifted
 * only once when we start up the parser, we can use 0 to signify an accept.
 * This is handy in practice because an accept is, by definition, a reduction
 * into the start state. Consequently, a YYR(0) in the parse table represents an
 * accepting action and the table-generation code doesn't have to treat the
 * accepting action any differently than a normal reduce.
 *
 * Note that if you change YY_TTYPE to something other than short, you can no
 * longer use the -T command-line switch.
 */

#define	YY_IS_ACCEPT	0	   	/* Accepting action (reduce by 0) */
#define	YY_IS_SHIFT(s)  ((s) > 0)  	/* s is a shift action		  */

typedef short 	YY_TTYPE;

#define YYF	((YY_TTYPE)( (unsigned short )~0 >>1 ))

/*----------------------------------------------------------------------
 * Various global variables used by the parser. They're here because they can
 * be referenced by the user-supplied actions, which follow these definitions.
 *
 * If -p or -a was given to OCCS, make Yy_rhslen and Yy_val (the right-hand
 * side length and the value used for $$) public, regardless of the value of
 * YYPRIVATE (yylval is always public). Note that occs generates extern
 * statements for these in yyacts.c (following the definitions section).
 */

#if !defined(YYACTION) || !defined(YYPARSER)
#    define YYP /* nothing  */
#else
#    define YYP   YYPRIVATE
#endif

YYPRIVATE int	  yynerrs = 0;			 /* Number of errors.         */

yystk_dcl( Yy_stack, int, YYMAXDEPTH ); 	 /* State stack.              */

    YYSTYPE yylval;			 	 /* Attribute for last token. */
YYP YYSTYPE Yy_val;				 /* Used to hold $$.          */

YYP YYSTYPE Yy_vstack[ YYMAXDEPTH ]; 	 	 /* Value stack. Can't use    */
YYP YYSTYPE *Yy_vsp;				 /* yystack.h macros because  */
						 /* YYSTYPE could be a struct.*/

YYP int     Yy_rhslen;			 	 /* Number of nonterminals on */
						 /* right-hand side of the    */
						 /* production being reduced. */

/* Prototypes for internal functions (local statics) */

YY_TTYPE yy_next	P(( YY_TTYPE **table, YY_TTYPE cur_state, int inp ));
void	 yy_init_stack	P(( void					  ));
int  	 yy_recover	P(( int tok, int suppress			  ));
void 	 yy_shift	P(( int new_state, int lookahead		  ));
int	 yy_act		P(( int yy_production_number, YYSTYPE *yyvsp	  ));
void	 yy_reduce	P(( int prod_num, int amount			  ));



  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @           Action subroutine and the Tables go here.			@
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @ The rest of the file is the actual parser. It's			@
  @ emitted after the tables but above any user-supplied code in the	@
  @ third part of the input file.     					@
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

YYPRIVATE YY_TTYPE  yy_next( table, cur_state, inp )
YY_TTYPE  **table;
YY_TTYPE  cur_state;
int       inp;
{
    /* Next-state routine for the compressed tables. Given current state and
     * input symbol (inp), return next state.
     */

    YY_TTYPE   *p = table[ cur_state ] ;
    int        i;

    if( p )
        for( i = (int) *p++; --i >= 0 ; p += 2 )
            if( inp == p[0] )
                 return p[1];

    return  YYF;
}

/*----------------------------------------------------------------------*/
#ifdef YYDEBUG

yystk_dcl( Yy_dstack, char*, YYMAXDEPTH );	     /* Symbol stack       */

ANSI( void 	yycode( char *fmt, ... ))
KnR ( void 	yycode( fmt )		)
KnR ( char	*fmt;			)
{
    va_list   	 args;
    va_start( args,  fmt );
    yy_output( 0, fmt, args );
}

ANSI( void 	yydata( char *fmt, ... ))
KnR ( void 	yydata( fmt )		)
KnR ( char	*fmt;			)
{
    va_list   	 args;
    va_start( args,  fmt );
    yy_output( 1, fmt, args );
}

ANSI( void 	yybss( char *fmt, ... ) )
KnR ( void 	yybss( fmt )		)
KnR ( char	*fmt;			)
{
    va_list   	 args;
    va_start( args,  fmt );
    yy_output( 2, fmt, args );
}

/* yycomment() and yyerror() are defined in yydebug.c */

#else  /*- - - - - - - - - - - - - - - - - - - - - - - - - - - */

#    define yy_nextoken()	yylex()	    /* when YYDEBUG isn't defined.   */
#    define yy_quit_debug()
#    define yy_init_debug()
#    define yy_pstack(x,y)
#    define yy_sym()

/* Use the following routines just like printf() to create output. The only
 * differences are that yycode is sent to the stream called yycodeout, yydata
 * goes to yydataout, and yybss goes to yybssout. All of these are initialized
 * to stdout. It's up to you to close the streams after the parser terminates.
 */

ANSI( void 	yycode( char *fmt, ... ))
KnR ( void 	yycode( fmt )		)
KnR ( char	*fmt;			)
{
    va_list	args;
    va_start( args,      fmt );
    vfprintf( yycodeout, fmt, args );
}

ANSI( void 	yydata( char *fmt, ... ))
KnR ( void 	yydata( fmt )		)
KnR ( char	*fmt;			)
{
    va_list	args;
    va_start( args,  fmt );
    vfprintf( yydataout, fmt, args );
}

ANSI( void 	yybss( char *fmt, ... )	)
KnR ( void 	yybss( fmt )		)
KnR ( char	*fmt;			)
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -