• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

C grammer for YACC

I need C grammer for YACC. It would be better if I also have code for a parser for it (which I can interface with a lexer).
What I am trying to do is to make a C to Pascal converter. I have made the lexer. Next I want to make the parser. And then the unparser. I am keen on keeping all these stages isolated. So I want a clean grammer code for YACC.
Thanks
0
pankajgupta
Asked:
pankajgupta
  • 2
1 Solution
 
jhanceCommented:
You can download the source code to GCC, the GNU C compiler from many places.  It uses YACC (actually bison) and is a good example that is readily available.
0
 
pankajguptaAuthor Commented:
Thanks!
Though I also need to know what exactly should be done in the parser phase of the compiler except just parsing the language! I mean like handling the symbol table and stuff like that. But this was helpful!
0
 
pankajguptaAuthor Commented:
Thanks!
Though I also need to know what exactly should be done in the parser phase of the compiler except just parsing the language! I mean like handling the symbol table and stuff like that. But this was helpful!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now