Listing 1. Sample Grammar

1  <application name='windowmanagershortcuts' expr='windowmanagershortcuts'> <![CDATA[
2      INCLUDE "numbers.bnf"
3      <direction> = up -> &Up; |down -> &Down; |left -> &Left; |right -> &Right; .
4      <<root>> = last window -> <key char='\\t' alt='true'/>  
5          | next window -> <key char='\\t' alt='true' shift='true'/> 
6          | insert e mail -> <key char='rob@smeg\.com'/>  
7          | move to view port {1|2|3|4|5} ->  <key char='&F{1};' alt='true'/>
8          | go {<direction>} {<raw-number>} -> <repeat count='{2}'> <key char='{1}'/></repeat>
9          | click button -> <mouse button='1' action='click' />
10         | double click button -> <mouse button='1' action='double click'/>
11         | move mouse {<raw-number>} left -> <mouse origin='relative' x='-{1}' y='0' />
12         | move mouse {<raw-number>} right -> <mouse origin='relative' x='{1}' y='0' />
13         | move mouse {<raw-number>} {(up -> -|down -> +)} -> <mouse origin='relative' x='0' y='{2}{1}' />
14         | move mouse to {<raw-number>} by {<raw-number>} -> <mouse origin='root' x='{1}' y='{2}' />
15         | close window -> <mouse origin='window' x='5' y='-5' button='1' action='click'/>  
16         | x term -> <call command='gnome-terminal' />
17         | mozilla -> <call command='/usr/local/mozilla/mozilla' />
18         | pine -> <call expr='Pine' command='gnome-terminal -t "Pine" -e "pine"' />
19         | play music -> <call command='xmms -p' />
20         | next song -> <call command='xmms -f' />
21         | previous song -> <call command='xmms -r' />
22         | stop music -> <call command='xmms -v' />
23 . ]]> </application>