Added grammar builder.
Refactored base grammar for use with the grammar builder.