import java_cup.runtime.Symbol; %% %full %char %line %cup %{ private Symbol token(int id, Object value) { return new Symbol(id, yychar, yyline, value); } private Symbol token(int id) { return token(id, yytext()); } %} %eofval{ return token(sym.EOF); %eofval} %% /* sítio da definição dos símbolos (tokens) // símbolos sem valor associado { ...; return token(sym.); } // símbolos com valor associado { ...; return token(sym., ); } // caracteres que não constituem um símbolo { ... /* código sem return */ ... } NOTA: apagar este comentário */ . { System.err.println("** Carácter inválido: `" + yytext() + "'"); return token(sym.ERRO); }