писал(а) в своём письме Fri, 23 Oct 2009 08:46:24 +0400:
> Kevin J. Cummings <[email protected]> писал(а) в своём письме > Fri, 23 Oct 2009 04:15:18 +0400: > >> On 10/22/2009 06:08 PM, Юрушкин Михаил wrote: >>> Good evening. >>> thanks for your support! >>> >>> Could u give me one tip. >>> I user C target and want to parse such input >>> >>> "a = 3.14 >>> f(x) = 3x^2 - 4x + 2 >>> >>> print "The value of f for " a " is " f(a) >>> print "The derivative of " f() " is " f'() >>> >>> >>> list variables >>> list functions >>> >>> g(y) = 2y^3 + 6y - 5 >>> h = f + g >>> print h()" >>> >>> I use this tutorial >>> http://jnb.ociweb.com/jnb/jnbJun2008.html >>> >>> but parser fails.. when finds empty lines. It's correct, but how can i >>> fix >>> it? It's common problem for all languages. Programmer can input some >>> empty >>> lines between constructions to improve code readability... >> >> Have your "whitespace" be "skipped" by your lexer? That's what I do in >> almost every compiler I've written. Your lexer tokenizes, and tokens >> can be seperated by whitespace, so, so long as you don't have lexer >> rules where whitespace is significant, you should be OK. mmm.. I understand this. Thank u. But I a little another problem FOR RORTRAN GRAMMAR first example: stmnt <\n> stmnt <\n> stmnt <;> <\n> // i mean <\n> is enough to seperate statements. <\n> token shouldn't be skiped -it's used by end_of_statement rule. But it's possible to write stmnt <\n> <\n> <\n> <stmnt> <\n> in this case 2nd and 3rd <\n> tokens do not figure in any rules.. they must be skiped. So hmm... it's a problem for lexer. what whould u advice to do with grammars? I know one method but it needs to write code to "override nextToken method" - but i think it's not good decision. Thank u very much! -- Best regards, Michael 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
