Skip to content
aemoncannon edited this page Sep 13, 2010 · 5 revisions

Flyparse-mode is an emacs minor-mode designed to support the creation of programming-language major-modes.
Flyparse uses external parsers to generate s-expression ASTs for language files, as they are being edited. Language modes are then able to query these ASTs using a declarative search syntax.

Features:

  • Pluggable architecture. It doesn’t matter how you implement the parser, as long as it supports the flyparse protocol.
  • Simple and unobtrusive. Can be used to compliment an existing language mode.
  • Provides an intuitive query language for accessing the parse-trees. For example, to get a list of all javascript function names in a file, you might say: (flyparse-query-all ’(“PROGRAM” “FUNCTION_DECLARATION” “FUNCTION_NAME” “IDENT”)).
  • Supports cross-file queries; it’s very simple to implement a ‘jump to definition’ helper.
  • Provides helper functions to pretty-print a buffer’s syntax tree or to overlay a shaded depth representation over the buffer (see images below).
  • Includes parsers for javascript, css and actionscript 3.
  • Allows for the creation of robust, readable language helpers.

Pictures are a lot more fun, so here’s some eye-candy. First off, prototype.js (that’s *3000*+ lines of hairy javascript) – flyparse is currently able to parse and load this AST in about 2 seconds (remember, emacs is not blocked):

Here’s the parse tree – pretty printed:

And here’s a colorized visualization of the code structure:

Clone this wiki locally