package test;

import java_cup.runtime.Symbol;

parser code {:

public void syntax_error( Symbol s )
{

    System.out.println("Error de Sintaxis");
    
    System.out.println( "Linea " + s.left );
    System.out.println( "Columna " + s.right );

}

public void unrecovered_syntax_error( Symbol s ) throws java.lang.Exception
{

}


:};

terminal String TK_ID ; 

terminal String TK_COMA ; 

non terminal DOC ; 

non terminal LISTA ;

DOC ::= LISTA {: System.out.println("doc ok"); :};

// al asignar la variable id al token, es decir TK_ID:id, se crean automaticamente las variables 
// idleft y idright, lo mismo sucede con cualquier nombre que usemos para la variable 
// por ejemplo TK_ID:palabra, crearia las variables palabraleft y palabraright 

LISTA ::= LISTA TK_COMA TK_ID:id {: System.out.println("ID en Linea " + idleft + " Columna " + idright + " Lexema " + id ); :}
         | TK_ID:id {: System.out.println("ID en Linea " + idleft + " Columna " + idright + " Lexema " + id ); :};
         