开发者

how to solve bison warning $1 of `GrammarCl' has no declared type

I have a grammar in BNF and i used BNF Converter to convert this grammar into executable program with C code. However, i have specific problem regarding $1 of `GrammarCl' has no declared type in GrammarCl.y file and i have no idea how to solve this there. I already looked at many forums and searched for this and try many things but still no idea on how to solve it.

The error i get is:

gcc -g -W -Wall -c Absyn.c

flex -PGrammarCl -oLexer.c GrammarCl.l

gcc -g -W -Wall -c Lexer.c

Lexer.c:1362: warning: ‘yyunput’ defined but not used

Lexer.c:1408: warning: ‘input’ defined but not used

bison -t -pGrammarCl GrammarCl.y -o Parser.c

GrammarCl.y:614.70-71: $1 of GrammarCl' has no declared type

GrammarCl.y:614.74-75: $2 ofGrammarCl' has no declared type

make: * [Parser.c] Error 1

The following is the grammar in GrammarCl.y file:

/* This Bison file was machine-generated by BNFC */
%{
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "Absyn.h"
#define initialize_lexer GrammarCl_initialize_lexer
extern int yyparse(void);
extern int yylex(void);
extern int initialize_lexer(FILE * inp);
void yyerror(const char *str)
{
  fprintf(stderr,"error: %s\n",str);
}

GrammarCl YY_RESULT_GrammarCl_ = 0;
GrammarCl pGrammarCl(FILE *inp)
{
  initialize_lexer(inp);
  if 开发者_开发问答(yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_GrammarCl_;
  }
}

Dictionary YY_RESULT_Dictionary_ = 0;
Dictionary pDictionary(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Dictionary_;
  }
}

Action YY_RESULT_Action_ = 0;
Action pAction(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Action_;
  }
}

Words YY_RESULT_Words_ = 0;
Words pWords(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Words_;
  }
}

Contract YY_RESULT_Contract_ = 0;
Contract pContract(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Contract_;
  }
}

Statement YY_RESULT_Statement_ = 0;
Statement pStatement(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Statement_;
  }
}

StatementSequence YY_RESULT_StatementSequence_ = 0;
StatementSequence pStatementSequence(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_StatementSequence_;
  }
}

Sentence YY_RESULT_Sentence_ = 0;
Sentence pSentence(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Sentence_;
  }
}

ListClause YY_RESULT_ListClause_ = 0;
ListClause pListClause(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ListClause_;
  }
}

ListClauseXorOBL YY_RESULT_ListClauseXorOBL_ = 0;
ListClauseXorOBL pListClauseXorOBL(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ListClauseXorOBL_;
  }
}

ListClauseXorPER YY_RESULT_ListClauseXorPER_ = 0;
ListClauseXorPER pListClauseXorPER(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ListClauseXorPER_;
  }
}

Clause YY_RESULT_Clause_ = 0;
Clause pClause(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Clause_;
  }
}

TestOpClause YY_RESULT_TestOpClause_ = 0;
TestOpClause pTestOpClause(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_TestOpClause_;
  }
}

TestOpCoAct YY_RESULT_TestOpCoAct_ = 0;
TestOpCoAct pTestOpCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_TestOpCoAct_;
  }
}

CTD YY_RESULT_CTD_ = 0;
CTD pCTD(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_CTD_;
  }
}

CTDCoAct YY_RESULT_CTDCoAct_ = 0;
CTDCoAct pCTDCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_CTDCoAct_;
  }
}

CTP YY_RESULT_CTP_ = 0;
CTP pCTP(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_CTP_;
  }
}

CTPCoAct YY_RESULT_CTPCoAct_ = 0;
CTPCoAct pCTPCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_CTPCoAct_;
  }
}

ObligationCl YY_RESULT_ObligationCl_ = 0;
ObligationCl pObligationCl(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ObligationCl_;
  }
}

OblCoAct YY_RESULT_OblCoAct_ = 0;
OblCoAct pOblCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_OblCoAct_;
  }
}

ProhibitionCl YY_RESULT_ProhibitionCl_ = 0;
ProhibitionCl pProhibitionCl(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ProhibitionCl_;
  }
}

ProCoAct YY_RESULT_ProCoAct_ = 0;
ProCoAct pProCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ProCoAct_;
  }
}

PermissionCl YY_RESULT_PermissionCl_ = 0;
PermissionCl pPermissionCl(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_PermissionCl_;
  }
}

PerCoAct YY_RESULT_PerCoAct_ = 0;
PerCoAct pPerCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_PerCoAct_;
  }
}

CoAct YY_RESULT_CoAct_ = 0;
CoAct pCoAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_CoAct_;
  }
}

CoActStar YY_RESULT_CoActStar_ = 0;
CoActStar pCoActStar(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_CoActStar_;
  }
}

Endurance YY_RESULT_Endurance_ = 0;
Endurance pEndurance(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Endurance_;
  }
}

ContradictionWords YY_RESULT_ContradictionWords_ = 0;
ContradictionWords pContradictionWords(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ContradictionWords_;
  }
}

ConWor YY_RESULT_ConWor_ = 0;
ConWor pConWor(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ConWor_;
  }
}

ContradictoryWor YY_RESULT_ContradictoryWor_ = 0;
ContradictoryWor pContradictoryWor(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_ContradictoryWor_;
  }
}

Act YY_RESULT_Act_ = 0;
Act pAct(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Act_;
  }
}

Variable_name YY_RESULT_Variable_name_ = 0;
Variable_name pVariable_name(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Variable_name_;
  }
}

WordAction YY_RESULT_WordAction_ = 0;
WordAction pWordAction(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_WordAction_;
  }
}

Lett YY_RESULT_Lett_ = 0;
Lett pLett(FILE *inp)
{
  initialize_lexer(inp);
  if (yyparse())
  { /* Failure */
    return 0;
  }
  else
  { /* Success */
    return YY_RESULT_Lett_;
  }
}



%}

%union
{
  int int_;
  char char_;
  double double_;
  char* string_;
  GrammarCl grammarcl_;
  Dictionary dictionary_;
  Action action_;
  Words words_;
  Contract contract_;
  Statement statement_;
  StatementSequence statementsequence_;
  Sentence sentence_;
  ListClause listclause_;
  ListClauseXorOBL listclausexorobl_;
  ListClauseXorPER listclausexorper_;
  Clause clause_;
  TestOpClause testopclause_;
  TestOpCoAct testopcoact_;
  CTD ctd_;
  CTDCoAct ctdcoact_;
  CTP ctp_;
  CTPCoAct ctpcoact_;
  ObligationCl obligationcl_;
  OblCoAct oblcoact_;
  ProhibitionCl prohibitioncl_;
  ProCoAct procoact_;
  PermissionCl permissioncl_;
  PerCoAct percoact_;
  CoAct coact_;
  CoActStar coactstar_;
  Endurance endurance_;
  ContradictionWords contradictionwords_;
  ConWor conwor_;
  ContradictoryWor contradictorywor_;
  Act act_;
  Variable_name variable_name_;
  WordAction wordaction_;
  Lett lett_;

}

%token _ERROR_
%token _SYMB_0    /*   =   */
%token _SYMB_1    /*   ;   */
%token _SYMB_2    /*   (   */
%token _SYMB_3    /*   )   */
%token _SYMB_4    /*   It is mandatory to   */
%token _SYMB_5    /*   if not   */
%token _SYMB_6    /*   It is prohibited to   */
%token _SYMB_7    /*   It is permitted to   */
%token _SYMB_8    /*   after then   */
%token _SYMB_9    /*   As long as   */
%token _SYMB_10    /*   as long as   */
%token _SYMB_11    /*   #   */
%token _SYMB_12    /*   After   */
%token _SYMB_13    /*   Always   */
%token _SYMB_14    /*   Contract   */
%token _SYMB_15    /*   Contradiction   */
%token _SYMB_16    /*   Dictionary   */
%token _SYMB_17    /*   If   */
%token _SYMB_18    /*   When   */
%token _SYMB_19    /*   after   */
%token _SYMB_20    /*   always   */
%token _SYMB_21    /*   and   */
%token _SYMB_22    /*   as   */
%token _SYMB_23    /*   bas   */
%token _SYMB_24    /*   begin1   */
%token _SYMB_25    /*   begin2   */
%token _SYMB_26    /*   begin3   */
%token _SYMB_27    /*   concurrently   */
%token _SYMB_28    /*   end1   */
%token _SYMB_29    /*   end2   */
%token _SYMB_30    /*   end3   */
%token _SYMB_31    /*   if   */
%token _SYMB_32    /*   not   */
%token _SYMB_33    /*   or   */
%token _SYMB_34    /*   then   */

%type <grammarcl_> GrammarCl
%type <dictionary_> Dictionary
%type <action_> Action
%type <words_> Words
%type <contract_> Contract
%type <statement_> Statement
%type <statementsequence_> StatementSequence
%type <sentence_> Sentence
%type <listclause_> ListClause
%type <listclausexorobl_> ListClauseXorOBL
%type <listclausexorper_> ListClauseXorPER
%type <clause_> Clause
%type <testopclause_> TestOpClause
%type <testopcoact_> TestOpCoAct
%type <ctd_> CTD
%type <ctdcoact_> CTDCoAct
%type <ctp_> CTP
%type <ctpcoact_> CTPCoAct
%type <obligationcl_> ObligationCl
%type <oblcoact_> OblCoAct
%type <prohibitioncl_> ProhibitionCl
%type <procoact_> ProCoAct
%type <permissioncl_> PermissionCl
%type <percoact_> PerCoAct
%type <coact_> CoAct
%type <coactstar_> CoActStar
%type <endurance_> Endurance
%type <contradictionwords_> ContradictionWords
%type <conwor_> ConWor
%type <contradictorywor_> ContradictoryWor
%type <act_> Act
%type <variable_name_> Variable_name
%type <wordaction_> WordAction
%type <lett_> Lett

%token<string_> _STRING_

%%
GrammarCl : _SYMB_16 _SYMB_14 ContradictionWords { $$ = make_Grammar($1, $2, $3); YY_RESULT_GrammarCl_= $$; } 
;
Dictionary : _SYMB_16 _SYMB_24 Action _SYMB_28 { $$ = make_DDictionary($3); YY_RESULT_Dictionary_= $$; } 
;
Action : Words { $$ = make_RecurA($1); YY_RESULT_Action_= $$; } 
  | Action Action { $$ = make_RecurB($1, $2); YY_RESULT_Action_= $$; }
;
Words : Variable_name _SYMB_0 _STRING_ _SYMB_1 { $$ = make_WWrd($1, $3); YY_RESULT_Words_= $$; } 
;
Contract : _SYMB_14 _SYMB_25 Statement _SYMB_29 { $$ = make_CCon($3); YY_RESULT_Contract_= $$; } 
;
Statement : StatementSequence { $$ = make_RecurC($1); YY_RESULT_Statement_= $$; } 
  | Statement Statement { $$ = make_RecurD($1, $2); YY_RESULT_Statement_= $$; }
;
StatementSequence : Sentence _SYMB_1 { $$ = make_SA($1); YY_RESULT_StatementSequence_= $$; } 
;
Sentence : ListClause { $$ = make_SentA($1); YY_RESULT_Sentence_= $$; } 
  | Sentence Sentence { $$ = make_SentB($1, $2); YY_RESULT_Sentence_= $$; }
;
ListClause : Clause { $$ = make_LLiAA($1); YY_RESULT_ListClause_= $$; } 
  | _SYMB_2 ListClauseXorOBL _SYMB_3 { $$ = make_LLiAB($2); YY_RESULT_ListClause_= $$; }
  | ListClauseXorPER { $$ = make_LLiAC($1); YY_RESULT_ListClause_= $$; }
  | ListClause _SYMB_21 ListClause { $$ = make_LLiAD($1, $3); YY_RESULT_ListClause_= $$; }
  | _SYMB_2 ListClause _SYMB_21 ListClause _SYMB_3 { $$ = make_LLiAE($2, $4); YY_RESULT_ListClause_= $$; }
;
ListClauseXorOBL : ObligationCl { $$ = make_LLiXA($1); YY_RESULT_ListClauseXorOBL_= $$; } 
  | ListClauseXorOBL _SYMB_33 ListClauseXorOBL { $$ = make_LLiXC($1, $3); YY_RESULT_ListClauseXorOBL_= $$; }
;
ListClauseXorPER : PermissionCl { $$ = make_LListXPA($1); YY_RESULT_ListClauseXorPER_= $$; } 
  | _SYMB_2 ListClauseXorPER _SYMB_33 ListClauseXorPER _SYMB_3 { $$ = make_LListXPB($2, $4); YY_RESULT_ListClauseXorPER_= $$; }
  | ListClauseXorPER _SYMB_33 ListClauseXorPER { $$ = make_LListXPC($1, $3); YY_RESULT_ListClauseXorPER_= $$; }
;
Clause : TestOpClause { $$ = make_CClA($1); YY_RESULT_Clause_= $$; } 
  | CTD { $$ = make_CClB($1); YY_RESULT_Clause_= $$; }
  | CTP { $$ = make_CClC($1); YY_RESULT_Clause_= $$; }
  | ObligationCl { $$ = make_CClD($1); YY_RESULT_Clause_= $$; }
  | ProhibitionCl { $$ = make_CClE($1); YY_RESULT_Clause_= $$; }
  | PermissionCl { $$ = make_CClF($1); YY_RESULT_Clause_= $$; }
  | ListClauseXorOBL { $$ = make_CClG($1); YY_RESULT_Clause_= $$; }
  | ListClauseXorPER { $$ = make_CClH($1); YY_RESULT_Clause_= $$; }
;
TestOpClause : TestOpCoAct { $$ = make_TTestA($1); YY_RESULT_TestOpClause_= $$; } 
;
TestOpCoAct : _SYMB_2 _SYMB_17 _SYMB_2 CoActStar _SYMB_3 _SYMB_34 Clause _SYMB_3 { $$ = make_TTestOpCA($4, $7); YY_RESULT_TestOpCoAct_= $$; } 
  | _SYMB_2 _SYMB_2 _SYMB_13 _SYMB_3 _SYMB_2 _SYMB_17 _SYMB_2 CoActStar _SYMB_3 _SYMB_34 Clause _SYMB_3 _SYMB_3 { $$ = make_TTestOpCB($8, $11); YY_RESULT_TestOpCoAct_= $$; }
  | _SYMB_2 _SYMB_2 _SYMB_12 _SYMB_3 _SYMB_2 _SYMB_17 _SYMB_2 CoActStar _SYMB_3 _SYMB_34 Clause _SYMB_3 _SYMB_3 { $$ = make_TTestOpCC($8, $11); YY_RESULT_TestOpCoAct_= $$; }
  | _SYMB_2 _SYMB_2 _SYMB_18 _SYMB_3 _SYMB_2 _SYMB_17 _SYMB_2 CoActStar _SYMB_3 _SYMB_34 Clause _SYMB_3 _SYMB_3 { $$ = make_TTestOpCD($8, $11); YY_RESULT_TestOpCoAct_= $$; }
;
CTD : CTDCoAct { $$ = make_CCTDA($1); YY_RESULT_CTD_= $$; } 
;
CTDCoAct : _SYMB_2 _SYMB_4 _SYMB_2 CoAct _SYMB_3 _SYMB_5 _SYMB_2 CoAct _SYMB_3 _SYMB_34 Clause _SYMB_3 { $$ = make_CCTDSB($4, $8, $11); YY_RESULT_CTDCoAct_= $$; } 
;
CTP : CTPCoAct { $$ = make_CCTA($1); YY_RESULT_CTP_= $$; } 
;
CTPCoAct : _SYMB_2 _SYMB_6 _SYMB_2 CoAct _SYMB_3 _SYMB_31 _SYMB_2 CoAct _SYMB_3 _SYMB_34 Clause _SYMB_3 { $$ = make_CCTPSB($4, $8, $11); YY_RESULT_CTPCoAct_= $$; } 
;
ObligationCl : OblCoAct { $$ = make_OOblCA($1); YY_RESULT_ObligationCl_= $$; } 
;
OblCoAct : _SYMB_2 _SYMB_4 _SYMB_2 CoAct _SYMB_3 _SYMB_3 { $$ = make_OOblA($4); YY_RESULT_OblCoAct_= $$; } 
;
ProhibitionCl : ProCoAct { $$ = make_PProCA($1); YY_RESULT_ProhibitionCl_= $$; } 
;
ProCoAct : _SYMB_2 _SYMB_6 _SYMB_2 CoAct _SYMB_3 _SYMB_3 { $$ = make_PProA($4); YY_RESULT_ProCoAct_= $$; } 
;
PermissionCl : PerCoAct { $$ = make_PPermA($1); YY_RESULT_PermissionCl_= $$; } 
;
PerCoAct : _SYMB_2 _SYMB_7 _SYMB_2 CoAct _SYMB_3 _SYMB_3 { $$ = make_PPerA($4); YY_RESULT_PerCoAct_= $$; } 
;
CoAct : Act { $$ = make_CCAA($1); YY_RESULT_CoAct_= $$; } 
  | CoAct _SYMB_21 CoAct { $$ = make_CCAB($1, $3); YY_RESULT_CoAct_= $$; }
  | CoAct _SYMB_33 CoAct { $$ = make_CCAC($1, $3); YY_RESULT_CoAct_= $$; }
  | CoAct _SYMB_8 CoAct { $$ = make_CCAD($1, $3); YY_RESULT_CoAct_= $$; }
  | CoAct _SYMB_21 CoAct _SYMB_27 { $$ = make_CCAE($1, $3); YY_RESULT_CoAct_= $$; }
  | _SYMB_2 Endurance _SYMB_2 CoAct _SYMB_3 _SYMB_3 { $$ = make_CCAF($2, $4); YY_RESULT_CoAct_= $$; }
  | _SYMB_2 _SYMB_32 _SYMB_2 CoAct _SYMB_3 _SYMB_3 { $$ = make_CCAG($4); YY_RESULT_CoAct_= $$; }
;
CoActStar : CoAct { $$ = make_CCAH($1); YY_RESULT_CoActStar_= $$; } 
  | CoActStar _SYMB_21 CoActStar { $$ = make_CCAI($1, $3); YY_RESULT_CoActStar_= $$; }
  | CoActStar _SYMB_33 CoActStar { $$ = make_CCAJ($1, $3); YY_RESULT_CoActStar_= $$; }
  | CoActStar _SYMB_8 CoActStar { $$ = make_CCAK($1, $3); YY_RESULT_CoActStar_= $$; }
  | CoActStar _SYMB_21 CoActStar _SYMB_27 { $$ = make_CCAL($1, $3); YY_RESULT_CoActStar_= $$; }
  | _SYMB_2 Endurance _SYMB_2 CoActStar _SYMB_3 _SYMB_3 { $$ = make_CCAM($2, $4); YY_RESULT_CoActStar_= $$; }
  | _SYMB_2 _SYMB_32 _SYMB_2 CoActStar _SYMB_3 _SYMB_3 { $$ = make_CCAN($4); YY_RESULT_CoActStar_= $$; }
;
Endurance : _SYMB_9 { $$ = make_EENA(); YY_RESULT_Endurance_= $$; } 
  | _SYMB_13 { $$ = make_EENB(); YY_RESULT_Endurance_= $$; }
  | _SYMB_10 { $$ = make_EENC(); YY_RESULT_Endurance_= $$; }
  | _SYMB_20 { $$ = make_EEND(); YY_RESULT_Endurance_= $$; }
  | _SYMB_19 { $$ = make_EENE(); YY_RESULT_Endurance_= $$; }
  | _SYMB_12 { $$ = make_EENF(); YY_RESULT_Endurance_= $$; }
;
ContradictionWords : _SYMB_15 _SYMB_26 ConWor _SYMB_30 { $$ = make_CConWorStr($3); YY_RESULT_ContradictionWords_= $$; } 
;
ConWor : ContradictoryWor { $$ = make_RecurE($1); YY_RESULT_ConWor_= $$; } 
  | ContradictoryWor ConWor { $$ = make_RecurF($1, $2); YY_RESULT_ConWor_= $$; }
;
ContradictoryWor : Act _SYMB_11 Act _SYMB_1 { $$ = make_CW($1, $3); YY_RESULT_ContradictoryWor_= $$; } 
;
Act : Variable_name { $$ = make_AAc($1); YY_RESULT_Act_= $$; } 
;
Variable_name : Lett { $$ = make_WWA($1); YY_RESULT_Variable_name_= $$; } 
;
WordAction : Lett { $$ = make_WWB($1); YY_RESULT_WordAction_= $$; } 
;
Lett : _SYMB_22 { $$ = make_LLTA(); YY_RESULT_Lett_= $$; } 
  | _SYMB_23 { $$ = make_LLTB(); YY_RESULT_Lett_= $$; }
;


You don't necessarily need a %type for all tokens. Many tokens (like operators) don't have a type associated with them, But they may still perform actions in the grammar rules. You do, however need to set a type when you send it somewhere. For example someObject.intVariable = $3 should become someObject.intVariable = $3 because you declared your union's int type to be int_.


Looks to me like you don't have %type declarations indicating what the lexer returns as values for _SYMB_16 and _SYMB_14.


You probably have to use $<name-of-type>1 and $<name-of-type>2, respectively, where “name-of-type” is one of your %union members. Like, $<wordaction_>1 or $<endurance_>2, whatever type is appropriate for the context.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜