[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8. Debugging

Writing language files using BNF is significantly easier than writing then using regular expressions in a functional manner. Debugging them, however, can still prove challenging.

There are two ways to debug a language definition if it is not behaving as expected. One way is to debug against the source `.bnf' file. The second is to debug against the lisp table created from the `.bnf' source, or perhaps written by hand.

If your language definition was written in BNF notation, debugging is quite easy. The command bovinate-debug will start you off.

Command: bovinate-debug
Bovinate the current buffer and run in debug mode.

If you prefer debugging against the Lisp table, find the table in a buffer, place the cursor in it, and use the command semantic-bovinate-debug-set-table in it.

Command: semantic-bovinate-debug-set-table &optional clear
Set the table for the next debug to be here. Optional argument CLEAR to unset the debug table.

After the table is set, the bovinate-debug command can be run at any time for the given language.

While debugging, two windows are visible. One window shows the file being parsed, and the syntactic token being tested is highlighted. The second window shows the table being used (either in the BNF source, or the Lisp table) with the current rule highlighted. The cursor will sit on the specific match rule being tested against.

In the minibuffer, a brief summary of the current situation is listed. The first element is the syntactic token which is a list of the form:

 
(TYPE START . END)

The rest of the display is a list of all strings collected for the currently tested rule. Each time a new rule is entered, the list is restarted. Upon returning from a rule into a previous match list, the previous match list is restored, with the production of the dependent rule in the list.

Use C-g to stop debugging. There are no commands for any fancier types of debugging.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by XEmacs Webmaster on October, 2 2007 using texi2html