In Lex i can start a new state using the keyword BEGIN STATE1. I want to do the same from yacc in between rules . In the action section of a rule , if i add BEGIN STATE1 , it says BEGIN undeclared error. Is there any way i can do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ise Wisteria found the answer for me.
Create separate functions in lex that use the BEGIN macro . Call them in bison .
Note:For those very beginners like me , do not forget to add a declaration of these functions at the beginning of the .y file or you will get an undeclared error during linking.