In my case (with this whole email referring to the grammar in my application, not the sample one I sent out), unary operators are handled in the 'prefix_operator' and 'postfix_operator' steps. One thing I forgot to mention in my first email: 21% of the total time spent in profiling was spent in 'primary_expression'. Since the total time spent in 'expression' was 23%, the 6 expression levels leading to 'primary_expression' are now taking so little time that it's clearly more beneficial for me to focus on optimizing either 'primary_expression', or better yet, the items that make up the remaining 77% of the parse time.
As an exercise, I plan to find a way to incorporate 'ternary_expression' into the flat parsing routine, which would lead to incorporating 'assignment_expression' as well. Sam -----Original Message----- From: Gavin Lambert [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2008 2:51 AM To: Sam Harwell; antlr-interest Subject: Re: [antlr-interest] Faster expression parsing At 15:31 28/08/2008, Sam Harwell wrote: >Profiling my grammar showed the expression parsing as one of the >slowest segments. The problem stemmed from the fact that this >grammar has ~18 precedence categories of operators, so getting to >a primary expression was unnecessarily slow. Here is an example >grammar that shows how you can flatten groups of operators while >maintaining a correct AST. What about unary operators? List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org:8080/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 -~----------~----~----~----~------~----~------~--~---
