To keep grammars relatively independent of contextual implementations you can use grammar macros in semantic actions, in place of direct calls to Emacs Lisp functions.
TAG macro is a good example:
(TAG $1 'nonterminal :children $4)
It offers a common syntax to produce a semantic tag, even if the underlying implementation is different between LALR and LL grammars.
A grammar macro is defined by a general macro name (for example,
TAG) associated to possibly several macro expanders.
A macro expander is an Emacs Lisp function that operates on the unevaluated expressions for the arguments, and returns a Lisp expression containing these argument expressions or parts of them.
Macro names are used like Lisp function names in call expressions. To help distinguish grammar macro calls from traditional Lisp function calls, macro names are automatically highlighted in semantic actions.
For more goodies that might help in the development of macros, See Editing grammars.
Commonly used macros are provided by the current grammar mode. See Adding a new grammar mode.
There are also local macros that only affect the grammar where they are declared. See use-macros Decl.