For recent Emacsen, bison-mode: https://github.com/Wilfred/bison-mode
Originally by Eric Beuscher, 1998: http://ftp.sunet.se/pub/gnu/emacs-lisp/incoming/bison-mode.el
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)) (beginning-of-buffer) (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.