public boolean checkAntBrainSyntax(String antBrainFile) throws Exception {

        BufferedReader br = new BufferedReader(new FileReader(antBrainFile));
        String currLine;
        int lineNumber = 0;

        // process each line in ant brain file
        while ((currLine = br.readLine()) != null) {

            lineNumber++;
            // convert current line to lowercase
            currLine = currLine.toLowerCase();

            // store variables used for regular expression
            String st = "[0-9][0-9]{0,3}";
            String i = "[0-5]";
            String comment = "(\\s*?;.*$)?"; // ignore everything after ;

            // check Sense
            String regex = "((sense)*\\s(here|ahead|leftahead|rightahead)\\s(" + st + ")\\s(" + st + ")\\s(friend|foe|friendwithfood|foewithfood|food|rock|(marker\\s" + i + ")|foemarker|home|foehome))" + comment;

            // check Mark and Unmark
            regex += "|((mark|unmark)*\\s(" + i + ")\\s(" + st + "))" + comment;

            // check PickUp and Move
            regex += "|((pickup|move)*\\s(" + st + ")\\s(" + st + "))" + comment;

            // check Drop
            regex += "|((drop)*\\s(" + st + "))" + comment;

            // check Turn
            regex += "|((turn)*\\s(left|right)\\s(" + st + "))" + comment;

            // check Flip
            regex += "|((flip)*\\s([0-9]*)\\s(" + st + ")\\s(" + st + "))" + comment;

            // perform regular expression
            Pattern p1 = Pattern.compile(regex);
            Matcher m = p1.matcher(currLine);

            // if current line doesn't match regular expression, print error
            // to terminal and return false (could possibly throw exception here?)
            if (!m.matches()) {
                //System.out.println("Error in java brain file "+file+" at line "+lineNumber+ ": "+currLine);
                throw new Exception("Error in java brain file " + antBrainFile + " at line " + lineNumber + ": " + currLine);
                //return false;
            }
        }
        return true;
    }