In order to generate the intermediate Emacs Lisp code needed by your parser, you have to query the grammar for the code, declarations, and rules it contains.
To obtain those information in a context free manner, grammar files are parsed by the semantic LALR parser to produce tags.
To query a grammar you can use the powerful API provided by semantic. see Application Development Manual.
For declarations, the grammar framework provides a specialized high level API.