Metamorphosis of gram.y

I often work with YACC (Bison) grammars, but still didn’t find comfortable editor for them. So I’m still using Notepad for this purpose. However, some time ago I found Perl script called linkify.pl as far as I remember, which produces HTML page based on the grammar and the list of non-terminal symbols. Edward Smirnov, colleague of mine, take this script and bring it to the completely new level.

What are the benefits of using such generated HTML page?

  • You can go exactly to whatever line number just adding #_<LINE>.

For example, if path to HTML grammar file is http://foo.com/MyGrammar.html, then http://foo.com/MyGrammar.html#_119 will bring you to the line number 119.

  • You can go exactly to the place where nonterminal symbol is defined.

All nonterminal symbols on this page are the links to theirs definitions indeed. Thus you may easily go down from the start symbol to the tokens using these links. One more benefit is that you may use “Back” browser button for one level up return.

  • Last but not least. Syntax highlighting: comments are grey, nonterminal symbols are close to red, the code and terminal symbols are navy.

Here you can find PostgreSQL LALR(1) grammar gram.y processed by this script.

One thought on “Metamorphosis of gram.y

  1. Pingback: Metamorphosis of gram.y: 9.0 « Pasha Golub's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s