Como passar o texto yy do arquivo lex para o yacc?
Por favor, estou enfrentando um problema simples .. aqui está o problema, no meu arquivo lex eu tenho algo semelhante a:
char *ptr_String;
"name = " { BEGIN sName; }
<sName>.+ {
ptr_String = (char *)calloc(strlen(yytext)+1, sizeof(char));
strcpy(ptr_String, yytext);
yylval.sValue = ptr_String;
return NAME;
}
Agora, no meu arquivo Yacc, tenho algo semelhante a:
stmt_Name:
NAME
{
/*Now here i need to get the matched string of <sName>.+ and measure it's length. */
/*The aim is simply outputing the name to the screen and storing the length in a global variable.
}
;
Por favor, alguma sugestão? Muito obrigado por todo o seu tempo e ajuda.