Thanks for your interest on the problem I 'm getting; The input I'm passing is a file without parsing errors; The code I'm using to test it is the one below:
CharStream input = new ANTLRFileStream(pathfiletest); BTLLexer lex = new BTLLexer(input); CommonTokenStream tokens = new CommonTokenStream(lex); BTLParser parser = new BTLParser(tokens); parser.decl_codigo(); if (parser.numErrors == 0) { parser.symbols_var.toString(); try { CommonTree tree = (CommonTree) parser.decl_codigo().getTree(); System.out.println("El arbol AST:"+ tree.toString()); } catch (RecognitionException e) { // TODO Auto-generated catch block e.printStackTrace(); } When i do pass i file with wrong statements, it does notify all the errors has to be notified, works properly. But in case of passing a correct file entry, for the grammar, i ' m getting the mentioned before error message. cheers and thanks, Marouane 2009/5/8 Indhu Bharathi <indh...@s7software.com>: > Looks like you are parsing with empty input. What is the input you gave to > the parser? > > Cheers, Indhu > > Marwan Ajraoui wrote: >> >> Hi there; >> >> I'm getting a strange error form a parser. I have defined a grammar, >> wich contains these rules; >> >> >> decl_codigo : decl_libreria decl_program >> >> decl_libreria : TAG_START_OPEN 'function_library' ':' FN_ID TAG_CLOSE >> decl_funciones TAG_END_OPEN 'function_library' TAG_CLOSE; >> >> decl_program : TAG_START_OPEN 'program' type_return '::' FN_ID ':' >> params_list TAG_CLOSE lista_instrucciones TAG_END_OPEN 'program' >> TAG_CLOSE ; >> >> >> >> So when i finish parsing the input tested, ANTLR notifies, >> >> line 0:-1 mismatched input '<EOF>' expecting TAG_START_OPEN >> >> To find out what could be the problem, i put the TAG_START_OPEN , so i >> got: >> >> line 0:-1 mismatched input '<EOF>' expecting 'function_library' >> >> >> I did check my .g, if i have some other reference to "decl_libreria", >> but No, the only reference is written is the one i mentioned before in >> the lines above. it is supposed to finish without errors and return an >> AST, as i set up the option. >> >> So why it does behave in recursive way? Any idea. >> >> >> thanks in advance >> >> >> >> > > -- Marouane List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---