I've just started using antlr so Id really appreciate the help! Im just trying to make a variable declaration declaration rule but its not working! Ive put the files Im working with below, please lmk if you need anything else!
INPUT CODE:
var test;
GRAMMAR G4 FILE:
grammar treetwo;
program : (declaration | statement)+ EOF;
declaration :
            variable_declaration
            | variable_assignment
            ;
statement:
        expression
        | ifstmnt
        ;
variable_declaration:
                    VAR NAME SEMICOLON
                    ;
variable_assignment:
                    NAME '=' NUM SEMICOLON
                    | NAME '=' STRING SEMICOLON
                    | NAME '=' BOOLEAN SEMICOLON
                    ;
expression:
            operand operation operand SEMICOLON
            | expression operation expression SEMICOLON
            | operand operation expression SEMICOLON
            | expression operation operand SEMICOLON
            ;
ifstmnt:
        IF LPAREN term RPAREN LCURLY
        (declaration | statement)+
        RCURLY
        ;
term:
    | NUM EQUALITY NUM
    | NAME EQUALITY NUM
    | NUM EQUALITY NAME
    | NAME EQUALITY NAME
    ;
/*Tokens*/
NUM : '0' | '-'?[1-9][0-9]*;
STRING: [a-zA-Z]+;
BOOLEAN: 'true' | 'false';
VAR : 'var';
NAME : [a-zA-Z]+;
SEMICOLON : ';';
LPAREN: '(';
RPAREN: ')';
LCURLY: '{';
RCURLY: '}';
EQUALITY: '==' | '<' | '>' | '<=' | '>=' | '!=' ;
operation: '+' | '-' | '*' | '/';
operand: NUM;
IF: 'if';
WS  :  [ \t\r\n]+ -> skip;
Error I'm getting:
(line 1,char 0): mismatched input 'var' expecting {NUM, 'var', NAME, 'if'}