I have a yacc file describing a certain language for which i am developing an Editor using IMP (eclipse project).I am using LPG as a parser generator, so I needed to extract a BNF rules from my yacc file. the yacc file i received contains rules and actions. However, I wanted to extract only the rules of the grammar description to be used in LPG. one way of doing this is by manually extracting the rules and reformatting it to BNF syntax (or may be writing a program to convert it to the way i want it). I was wondering if there is an automated way of doing this. I read in some blogs that bison could help but i couldn't exactly find the appropriate commands. does anybody knows how to deal with this problem.
I can't really post the yacc file i have since it is confidential. but i could give an example as follows
argExprList:
assignExp
{
// some rules here
}
| assignExpList ',' assignExp
{
//some other rules here
}
;
what i wanted it to be converted to is simply like
argExpList ::= assignExp|assignExpList ',' assignExp