저는 컴파일러를 만들려고하고 있으며, 이제는 파서를 만들려고합니다. 나는이 상태에 대한 경고를 얻을 : 주를 89shift/reduse 경고를 제거하는 방법은 무엇입니까?
62 expr: '(' expr . ')'
66 | expr . '+' expr
67 | expr . '-' expr
68 | expr . '*' expr
69 | expr . '/' expr
70 | expr . '%' expr
74 | expr . '&' expr
75 | expr . '|' expr
77 cond: expr .
78 | '(' expr . ')'
82 | expr . '=' expr
83 | expr . "<>" expr
84 | expr . '<' expr
85 | expr . '>' expr
86 | expr . ">=" expr
87 | expr . "<=" expr
"<>" shift, and go to state 91
">=" shift, and go to state 92
"<=" shift, and go to state 93
'+' shift, and go to state 94
'-' shift, and go to state 95
'|' shift, and go to state 96
'*' shift, and go to state 97
'/' shift, and go to state 98
'%' shift, and go to state 99
'&' shift, and go to state 100
'=' shift, and go to state 101
'<' shift, and go to state 102
'>' shift, and go to state 103
')' shift, and go to state 119
$default reduce using rule 77 (cond)
State 119
62 expr: '(' expr ')' .
78 cond: '(' expr ')' .
"and" reduce using rule 62 (expr)
"and" [reduce using rule 78 (cond)]
"or" reduce using rule 62 (expr)
"or" [reduce using rule 78 (cond)]
':' reduce using rule 62 (expr)
':' [reduce using rule 78 (cond)]
')' reduce using rule 62 (expr)
')' [reduce using rule 78 (cond)]
$default reduce using rule 62 (expr)
이 부분에 대한 나의 문법은 다음과 같습니다
expr:
T_const |
T_char_const |
l_value |
'(' expr ')' |
func_call |
'+' expr |
'-' expr |
expr '+' expr |
expr '-' expr |
expr '*' expr |
expr '/' expr |
expr '%' expr |
T_true | T_false |
'!' expr |
expr '&' expr |
expr '|' expr
;
cond:
'(' cond ')' |
expr |
T_not cond |
cond T_and cond |
cond T_or cond |
expr '=' expr |
expr T_not_equal expr |
expr '<' expr |
expr '>' expr |
expr T_greater_equal expr |
expr T_less_equal expr
;
여기서 문제가 무엇이며 내가 아마 고칠 수있는 방법 이미 고정이? 일부 교대/문제를 줄이기는하지만 일반적으로이 문제가 무엇인지 이해하지 못했습니다. 당신에게
주 끝에서 두 줄을 깜박입니다. ') [규칙 77 (조건)을 사용하여 줄이기] 규칙 77 (조건)을 사용하여 $ 줄입니다. – Nwlis
[편집]을 사용하여 게시물을 편집하십시오. –