Updated grammar.
Wrote gridify function and wrote evaluate code to find #main.