如何在C++中使用LEX或YACC中的移位、缩小、错误、接受和冲突关键字?
这些关键词的含义是什么: 转移、减少、错误、接受、冲突 请详细描述每一项如何在C++中使用LEX或YACC中的移位、缩小、错误、接受和冲突关键字?,c++,yacc,lex,C++,Yacc,Lex,这些关键词的含义是什么: 转移、减少、错误、接受、冲突 请详细描述每一项 switch ( oAction) { case SSYaccAction::shift: oElement = shift( lookahead()); if ( !oElement) return SSTrue; oElement->oLexeme = lookahead(); oElement->oulState = state(); pu
switch ( oAction)
{
case SSYaccAction::shift:
oElement = shift( lookahead());
if ( !oElement) return SSTrue;
oElement->oLexeme = lookahead();
oElement->oulState = state();
push();
if ( getLexeme()) return SSTrue;
oulError++;
break;
case SSYaccAction::reduce:
oElement = reduce( production(), productionSize());
if ( !oElement) return SSTrue;
pop( productionSize());
if ( goTo( leftside())) return SSTrue;
break;
case SSYaccAction::error:
oError = SSTrue;
if ( error( state(), lookahead()))
return SSTrue;
oulError = 0;
break;
case SSYaccAction::accept:
return accept();
default:
throwException( SSExceptionYaccParse, SSYaccMsgParse);
return SSTrue;
在上面的代码中,是什么意思
lookahead()
及
@克利比写道:
你读过雅克吗?这包含了对上述内容的清晰解释,以及许多其他信息,可以帮助您开始学习
你读过雅克吗?这包含了对以上内容的清晰解释,以及许多其他信息,可以帮助您开始。对不起,链接错误,我现在已经更新了!抱歉,没有链接…请单击我上面评论中的word文档:
reduce(production(), productionSize())