For recent Emacsen, bison-mode:

Originally by Eric Beuscher, 1998:

This mode might need an additional (require 'cc-mode) and (require 'font-lock) to work with recent emacses.

Handy imenu function for jumping around to different rules in a bison/yacc file. Call this in your .y file however you like.

  (setq imenu-create-index-function 
        (lambda ()
          (let ((end))
             (re-search-forward "^%%")
             (forward-line 1)
             (setq end (save-excursion (re-search-forward "^%%") (point)))
             (loop while (re-search-forward "^\\([a-z].*?\\)\\s-*\n?\\s-*:" end t)
                   collect (cons (match-string 1) (point))))))

See also FlexMode.

CategoryModes ProgrammingModes