2011-03-23 2 views
0

BNF에 문법이 있으며 BNF 변환기를 사용하여이 문법을 C 코드로 실행 가능한 프로그램으로 변환합니다. 그러나, 나는 GrammarCl.y 파일에 선언 된 타입이 없기 때문에 'GrammarCl'의 $ 1에 관한 특정한 문제가있다. 나는 이것을 어떻게 해결할 지 모른다. 나는 이미 많은 포럼을 살펴 보았고 이것을 찾아서 많은 것들을 시도했지만 해결 방법에 대해서는 아직 모른다. 내가 얻을

오류 :

의 gcc -g -W -Wall -c Absyn.c
플렉스 -PGrammarCl -oLexer.c GrammarCl.l
의 gcc -g -W -Wall - C Lexer.c
Lexer.c : 1362 : 경고 : 'yyunput'정의되어 있지만
Lexer.c 사용하지 : 1408 : 경고 : '입력'을 정의하지만
들소를 사용하지 -t -pGrammarCl GrammarCl.y -o Parser.c
GrammarCl.y : 614.70-71 : $ 1의 GrammarCl' has no declared type
GrammarCl.y:614.74-75: $2 of
문법 이 * [을 parser.c] 오류 1

다음 GrammarCl.y 파일의 문법입니다 :

/* 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_= $$; } 
; 
+1

안녕하세요, StackOverflow에 오신 것을 환영합니다! 각 줄 앞에' '>'를 붙이고 그 줄 끝에 두 개의 공백을 추가하여 줄을 닫을 수 있습니다. 편집기에서 강조 표시하고 중괄호 아이콘을 클릭하여 코드 서식을 지정할 수 있습니다. 이 두 가지 모두 귀하의 질문을보다 쉽게 ​​읽을 수 있도록 도와줍니다! :-) 나는이 질문에서 당신을 위해 앞서 갔고 그것을 끝냈습니다. 그러나 미래를 염두에두고이 팁들을 지켜보십시오. :-) –

답변

0

당신 돈처럼 나에게 보이는 CL은 '어떤 유형을
메이크업을 선언하지 않았다 lexer가 _SYMB_16_SYMB_14에 대한 값으로 반환하는 것을 나타내는 %type 선언이 있습니다.

0

당신은 아마 사용해야 $<이름의 형>1$<이름의 형 "이름의 형는"당신의 %union 멤버 중 하나입니다 각각 >2,. 문맥에 맞는 유형이든간에 $<wordaction_>1 또는 $<endurance_>2과 같습니다.

1

모든 토큰에 % 유형이 반드시 필요한 것은 아닙니다. 많은 토큰 (연산자와 같은)은 그와 관련된 유형이 없지만 문법 규칙에서 여전히 작업을 수행 할 수 있습니다. 그렇지만 유형을 보낼 때 유형을 설정해야합니다. 예를 들어 someObject.intVariable = $ 3 someObject.intVariable = $ 3 으로 지정해야합니다. 조합의 int 유형이 int_로 선언 되었기 때문입니다.

관련 문제