+- gotos is a copy of GOTOS.
+
+- symbol-obarray is an obarray containing functions that
+implement the semantic action for each nonterminal; the function
+names have the format nonterm:index."
+ ;; We store named symbols for semantic actions, not just lambda
+ ;; functions, so we have a name for debug trace.
+ ;;
+ ;; FIXME: TERMINALS is not used. Eliminating it requires decoupling
+ ;; from OpenToken; we'll do that in the move to FastToken.
+ ;;
+ ;; FIXME: eliminate use of semantic-lex-* in *-wy.el. Similarly
+ ;; requires decoupling from OpenToken
+ ;;
+ ;; FIXME: can eliminate obarray? We don't need the obarray to
+ ;; avoid garbage collection of the symbols; they are all referenced in the compiled grammar.
+ ;; But each semantic action function has to be defined (and byte-compiled?) somewhere?
+ ;; currently actions are _not_ byte-compiled; wisi-compile-grammar is run at load time
+ ;; need 'eval-when-compile' to byte-compile them?
+ ;; can't byte-compile obarray?
+
+ (let ((defs (nth 1 grammar))
+ (symbol-obarray (make-vector 13 0));; for parse actions
+ def nonterm rhs-list rule
+ semantic-action index)
+
+ (while defs
+ (setq def (car defs)
+ defs (cdr defs)
+ nonterm (car def)
+ rhs-list (cdr def)
+ index 0)
+ (while rhs-list
+ (setq rule (car rhs-list)
+ rhs-list (cdr rhs-list)
+ semantic-action (cadr rule))
+
+ (when semantic-action
+ (wisi-semantic-action semantic-action nonterm index symbol-obarray))
+
+ (setq index (1+ index))
+ ))
+
+ ;; replace semantic actions in ACTIONS with symbols from symbol-obarray