Bison uses the following paradigm:
// declarations
%%
non-terminal : rule { c/c++ action }
%%
// your functions
So to elaborate on the previous answer:
prog:
PROGMY IDENT ';' decls BEGINMY stats ENDMY '.'
{ your code; }
; // bison (not C/C++) terminal semi-colon
As a separate note, since parsers are slow you might want to use "inline" for code functions as much as reasonable. The previous comment on what code there is to write is right-on. That is, if you are going to insert a symbol into a symbol table, you need to discover whether the symbol is there, and if not, then insert it.