Hello, After having the Dragon book unread on the shelf for 15 years I finally try to learn about parsing in general and ANTLR in particular by building a toy programming language based on the various Expression Evaluator examples on the Net and in the ANTLR book.
It all works fine unless my input is free of whitespace. But when I add empty lines to my input my parser fails with messages like "line 8:0 no viable alternative at input u'DauerParty'". The Grammar I use is quite close to the various examples: program: (code); code: ( stat )+ -> ^(CODE stat+) ; stat: VARIABLE '=' additionExp (NEWLINE|EOF) -> ^(ASSIGNMENT VARIABLE additionExp) | NEWLINE -> ; additionExp : multiplyExp ((PLUS^|MINUS^) multiplyExp)* ; multiplyExp : atomExp ((MAL^|DURCH^) atomExp)* ; atomExp : CONSTANT | VARIABLE | '('! additionExp ')'! ; ... NEWLINE: '\r'? '\n'; /* We're going to ignore all white space characters */ WHITESPACE : ( '\t' | ' ' | '\u000C' | NEWLINE )+ { $channel = HIDDEN; }; (Complete Grammar at http://gist.github.com/328943#) If feed with the following input I get errors between two statements - the first time in between the KostenRaum and the DauerParty lines. By using the ANTLRworks debugger it seemst that the newline after "KostenRaum = 3000" isn't detected. Any hints on what I'm doing wrong? -----8<--------------------- AnzahlBesucher = 500 KostenRaum = 3000 DauerParty = 9 StundenlohnHelfer = 15 -----8<--------------------- (Complete input at http://gist.github.com/328945#) Any hints would be greatly aprechiated --md -- 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-inter...@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.