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

📄 calc_yacc.c

📁 绘制一元函数曲线的工具 输入C语言语法的函数公式, 即可绘制函数的二维曲线 采用内置编译器和虚拟机(这是调整OK的版本)
💻 C
📖 第 1 页 / 共 5 页
字号:
#line 102 "calc_yacc.y"    { (yyval.n_point) = (yyvsp[(1) - (1)].n_point); ;}    break;  case 10:#line 103 "calc_yacc.y"    { (yyval.n_point) = (yyvsp[(1) - (1)].n_point); ;}    break;  case 11:#line 104 "calc_yacc.y"    { (yyval.n_point) = (yyvsp[(2) - (3)].n_point); ;}    break;  case 12:#line 108 "calc_yacc.y"    { (yyval.n_point) = exp_op(IFX, 2, (yyvsp[(3) - (5)].n_point), (yyvsp[(5) - (5)].n_point)    ); ;}    break;  case 13:#line 109 "calc_yacc.y"    { (yyval.n_point) = exp_op(IFX, 3, (yyvsp[(3) - (7)].n_point), (yyvsp[(5) - (7)].n_point), (yyvsp[(7) - (7)].n_point)); ;}    break;  case 14:#line 113 "calc_yacc.y"    { (yyval.n_point) = exp_op(DO   , 2, (yyvsp[(2) - (7)].n_point), (yyvsp[(5) - (7)].n_point)); ;}    break;  case 15:#line 114 "calc_yacc.y"    { (yyval.n_point) = exp_op(WHILE, 2, (yyvsp[(3) - (5)].n_point), (yyvsp[(5) - (5)].n_point)); ;}    break;  case 16:#line 115 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4, (yyvsp[(3) - (9)].n_point), (yyvsp[(5) - (9)].n_point), (yyvsp[(7) - (9)].n_point), (yyvsp[(9) - (9)].n_point)); ;}    break;  case 17:#line 116 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4, (yyvsp[(3) - (8)].n_point), (yyvsp[(5) - (8)].n_point),  0, (yyvsp[(8) - (8)].n_point)); ;}    break;  case 18:#line 117 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4, (yyvsp[(3) - (8)].n_point),  0, (yyvsp[(6) - (8)].n_point), (yyvsp[(8) - (8)].n_point)); ;}    break;  case 19:#line 118 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4, (yyvsp[(3) - (7)].n_point),  0,  0, (yyvsp[(7) - (7)].n_point)); ;}    break;  case 20:#line 119 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4,  0, (yyvsp[(4) - (8)].n_point), (yyvsp[(6) - (8)].n_point), (yyvsp[(8) - (8)].n_point)); ;}    break;  case 21:#line 120 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4,  0, (yyvsp[(4) - (7)].n_point),  0, (yyvsp[(7) - (7)].n_point)); ;}    break;  case 22:#line 121 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4,  0,  0, (yyvsp[(5) - (7)].n_point), (yyvsp[(7) - (7)].n_point)); ;}    break;  case 23:#line 122 "calc_yacc.y"    { (yyval.n_point) = exp_op(FOR  , 4,  0,  0,  0, (yyvsp[(6) - (6)].n_point)); ;}    break;  case 24:#line 126 "calc_yacc.y"    { (yyval.n_point) = exp_op(BREAK, 0); ;}    break;  case 25:#line 127 "calc_yacc.y"    { (yyval.n_point) = exp_op(CONTI, 0); ;}    break;  case 26:#line 131 "calc_yacc.y"    { (yyval.n_point) = ass_op( GOTO, (yyvsp[(2) - (3)].s_value),  0); ;}    break;  case 27:#line 132 "calc_yacc.y"    { (yyval.n_point) = ass_op(LABEL, (yyvsp[(1) - (3)].s_value), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 28:#line 136 "calc_yacc.y"    { (yyval.n_point) = con_cr((yyvsp[(1) - (1)].r_value)); ;}    break;  case 29:#line 137 "calc_yacc.y"    { (yyval.n_point) = con_ci((yyvsp[(1) - (1)].i_value)); ;}    break;  case 30:#line 138 "calc_yacc.y"    { (yyval.n_point) = con_cc((yyvsp[(1) - (1)].c_value)); ;}    break;  case 31:#line 139 "calc_yacc.y"    { (yyval.n_point) = con_cs((yyvsp[(1) - (1)].s_value)); ;}    break;  case 32:#line 140 "calc_yacc.y"    { (yyval.n_point) = var_id((yyvsp[(1) - (1)].s_value)); ;}    break;  case 33:#line 141 "calc_yacc.y"    { (yyval.n_point) = ass_op((yyvsp[(2) - (3)].i_value), (yyvsp[(1) - (3)].s_value), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 34:#line 142 "calc_yacc.y"    { (yyval.n_point) = exp_op(OOR, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 35:#line 143 "calc_yacc.y"    { (yyval.n_point) = exp_op(AND, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 36:#line 144 "calc_yacc.y"    { (yyval.n_point) = exp_op('|', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 37:#line 145 "calc_yacc.y"    { (yyval.n_point) = exp_op('^', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 38:#line 146 "calc_yacc.y"    { (yyval.n_point) = exp_op('&', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 39:#line 147 "calc_yacc.y"    { (yyval.n_point) = exp_op(CEQ, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 40:#line 148 "calc_yacc.y"    { (yyval.n_point) = exp_op(CNE, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 41:#line 149 "calc_yacc.y"    { (yyval.n_point) = exp_op(CLE, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 42:#line 150 "calc_yacc.y"    { (yyval.n_point) = exp_op(CGE, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 43:#line 151 "calc_yacc.y"    { (yyval.n_point) = exp_op('<', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 44:#line 152 "calc_yacc.y"    { (yyval.n_point) = exp_op('>', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 45:#line 153 "calc_yacc.y"    { (yyval.n_point) = exp_op(SHL, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 46:#line 154 "calc_yacc.y"    { (yyval.n_point) = exp_op(SHR, 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 47:#line 155 "calc_yacc.y"    { (yyval.n_point) = exp_op('+', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 48:#line 156 "calc_yacc.y"    { (yyval.n_point) = exp_op('-', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 49:#line 157 "calc_yacc.y"    { (yyval.n_point) = exp_op('*', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 50:#line 158 "calc_yacc.y"    { (yyval.n_point) = exp_op('/', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 51:#line 159 "calc_yacc.y"    { (yyval.n_point) = exp_op('%', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;  case 52:#line 160 "calc_yacc.y"    { (yyval.n_point) = exp_op('!', 1, (yyvsp[(2) - (2)].n_point)); ;}    break;  case 53:#line 161 "calc_yacc.y"    { (yyval.n_point) = exp_op('~', 1, (yyvsp[(2) - (2)].n_point)); ;}    break;  case 54:#line 162 "calc_yacc.y"    { (yyval.n_point) = exp_op(UMI, 1, (yyvsp[(2) - (2)].n_point)); ;}    break;  case 55:#line 163 "calc_yacc.y"    { (yyval.n_point) = ass_op(INCB, (yyvsp[(2) - (2)].s_value),  0); ;}    break;  case 56:#line 164 "calc_yacc.y"    { (yyval.n_point) = ass_op(DECB, (yyvsp[(2) - (2)].s_value),  0); ;}    break;  case 57:#line 165 "calc_yacc.y"    { (yyval.n_point) = ass_op(INCA, (yyvsp[(1) - (2)].s_value),  0); ;}    break;  case 58:#line 166 "calc_yacc.y"    { (yyval.n_point) = ass_op(DECA, (yyvsp[(1) - (2)].s_value),  0); ;}    break;  case 59:#line 167 "calc_yacc.y"    { (yyval.n_point) = ass_op(CALL, (yyvsp[(1) - (3)].s_value),  0); ;}    break;  case 60:#line 168 "calc_yacc.y"    { (yyval.n_point) = ass_op(CALL, (yyvsp[(1) - (4)].s_value), (yyvsp[(3) - (4)].n_point)); ;}    break;  case 61:#line 169 "calc_yacc.y"    { (yyval.n_point) = (yyvsp[(2) - (3)].n_point); ;}    break;  case 62:#line 173 "calc_yacc.y"    { (yyval.n_point) = exp_op(',', 2,  0, (yyvsp[(1) - (1)].n_point)); ;}    break;  case 63:#line 174 "calc_yacc.y"    { (yyval.n_point) = exp_op(',', 2, (yyvsp[(1) - (3)].n_point), (yyvsp[(3) - (3)].n_point)); ;}    break;/* Line 1267 of yacc.c.  */#line 1950 "calc_yacc.c"      default: break;    }  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);  YYPOPSTACK (yylen);  yylen = 0;  YY_STACK_PRINT (yyss, yyssp);  *++yyvsp = yyval;  /* Now `shift' the result of the reduction.  Determine what state     that goes to, based on the state we popped back to and the rule     number reduced by.  */  yyn = yyr1[yyn];  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)    yystate = yytable[yystate];  else    yystate = yydefgoto[yyn - YYNTOKENS];  goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/yyerrlab:  /* If not already recovering from an error, report this error.  */  if (!yyerrstatus)    {      ++yynerrs;#if ! YYERROR_VERBOSE      yyerror (YY_("syntax error"));#else      {	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)	  {	    YYSIZE_T yyalloc = 2 * yysize;	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))	      yyalloc = YYSTACK_ALLOC_MAXIMUM;	    if (yymsg != yymsgbuf)	      YYSTACK_FREE (yymsg);	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);	    if (yymsg)	      yymsg_alloc = yyalloc;	    else	      {		yymsg = yymsgbuf;		yymsg_alloc = sizeof yymsgbuf;	      }	  }	if (0 < yysize && yysize <= yymsg_alloc)	  {	    (void) yysyntax_error (yymsg, yystate, yychar);	    yyerror (yymsg);	  }	else	  {	    yyerror (YY_("syntax error"));	    if (yysize != 0)	      goto yyexhaustedlab;	  }      }#endif    }  if (yyerrstatus == 3)    {      /* If just tried and failed to reuse look-ahead token after an	 error, discard it.  */      if (yychar <= YYEOF)	{	  /* Return failure if at end of input.  */	  if (yychar == YYEOF)	    YYABORT;	}      else	{	  yydestruct ("Error: discarding",		      yytoken, &yylval);	  yychar = YYEMPTY;	}    }  /* Else will try to reuse look-ahead token after shifting the error     token.  */  goto yyerrlab1;/*---------------------------------------------------.| yyerrorlab -- error raised explicitly by YYERROR.  |`---------------------------------------------------*/yyerrorlab:  /* Pacify compilers like GCC when the user code never invokes     YYERROR and the label yyerrorlab therefore never appears in user     code.  */  if (/*CONSTCOND*/ 0)     goto yyerrorlab;  /* Do not reclaim the symbols of the rule which action triggered     this YYERROR.  */  YYPOPSTACK (yylen);  yylen = 0;  YY_STACK_PRINT (yyss, yyssp);  yystate = *yyssp;  goto yyerrlab1;/*-------------------------------------------------------------.| yyerrlab1 -- common code for both syntax error and YYERROR.  |`-------------------------------------------------------------*/yyerrlab1:  yyerrstatus = 3;	/* Each real token shifted decrements this.  */  for (;;)    {      yyn = yypact[yystate];      if (yyn != YYPACT_NINF)	{	  yyn += YYTERROR;	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)	    {	      yyn = yytable[yyn];	      if (0 < yyn)		break;	    }	}      /* Pop the current state because it cannot handle the error token.  */      if (yyssp == yyss)	

⌨️ 快捷键说明

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