wisent: Debugging actions
3.5 Debugging semantic actions
==============================
Each semantic action is represented by a symbol interned in an “obarray”
that is part of the LALR(1) automaton (Compiling a grammar).
‘symbol-function’ on a semantic action symbol return the semantic action
lambda expression.
A semantic action symbol name has the form ‘NONTERMINAL:INDEX’, where
NONTERMINAL is the name of the nonterminal symbol the action belongs to,
and INDEX is an action sequence number within the scope of NONTERMINAL.
For example, this nonterminal definition:
input:
line [input:0]
| input line
(format "%s %s" $1 $2) [input:1]
;
Will produce two semantic actions, and associated symbols:
‘input:0’
A default action that returns ‘$1’.
‘input:1’
That returns ‘(format "%s %s" $1 $2)’.
Debugging uses the Lisp debugger to investigate what is happening
during execution of semantic actions. Three commands are available to
debug semantic actions. They receive two arguments:
• The automaton that contains the semantic action.
• The semantic action symbol.
-- Command: wisent-debug-on-entry automaton function
Request AUTOMATON’s FUNCTION to invoke debugger each time it is
called. FUNCTION must be a semantic action symbol that exists in
AUTOMATON.
-- Command: wisent-cancel-debug-on-entry automaton function
Undo effect of ‘wisent-debug-on-entry’ on AUTOMATON’s FUNCTION.
FUNCTION must be a semantic action symbol that exists in AUTOMATON.
-- Command: wisent-debug-show-entry automaton function
Show the source of AUTOMATON’s semantic action FUNCTION. FUNCTION
must be a semantic action symbol that exists in AUTOMATON.