Next: , Previous: Grammar File, Up: Top

3 Grammar Development Cycle

When developing a grammar using the Semantic Grammar mode, the write, compile, test cycle takes a few steps. The following pattern works well:

Step 1:

Make changes in the grammar file.

Step 2:

Press C-c C-c to compile the .by or .wy grammar file into an Emacs Lisp file, such as mylanguage-wy.el. The cursor will end in this file.

If you have never loaded this language before, then use

     M-x eval-buffer RET

to get it running. If you have loaded a previous revision in, then instead use eval-defun bound to C-M-x on the changed generated variables.

The generated variables are:

This table is modified if you changed any %keyword entries.
This table is modified if you changed any %token entries.
This table is modified if you change the grammar.
The lexer is modified if you change that explicit code in the .wy file.

Once you have reset the value of the particular part of the grammar you changed, switch to a buffer that you use for testing the grammar, and reinitialize that buffer. Usually this is something like

     M-x revert-buffer RET


     M-x LANG-mode RET

Once a buffer has been reparsed, use semantic-show-unmatched-syntax mode, senator-pulse-tag C-c , ?, and M-x bovinate RET to quickly identify success or failure of your changes.