In order of their effect, here are the things you'll want to do to improve speed. And when I say these are ordered, I mean there's a good chance that changing a lower bullet point without changing the ones above will have negligible results.
* Left factor your grammar to remove the backtracking=true
option.
* Remove semantic predicates (these show as {}? In the code).
Sometimes this will force you to build an ambiguous tree with a node
like "SomethingOrSomethingElse" that you can resolve in a tree walker
later by explicitly setting its type to "Something" or "SomethingElse"
once you determine the correct answer.
* Make your syntactic predicates look as "least ahead" as
absolutely possible. Again, sometimes you can relax the rules of your
AST and resolve those in the tree walker later and greatly decrease the
lookahead requirement.
* Use a "flat" expression parser like I sent to the list in the
past. The more operators your language has, the bigger difference it
will make.
Sam
From: [email protected]
[mailto:[email protected]] On Behalf Of Bharath R
Sent: Thursday, September 10, 2009 6:55 AM
To: 'antlr-interest'
Subject: [antlr-interest] Optimized code generation
Hi All ,
Pls let me know what are all the option that I could use , to get the
generated code with more performance. ( Need to be fast in parsing ).
I have enabled " backtracking = true " , will this hits the performance
???
Without this option some ambiquity is coming.
Pls help me in providing any better performace tuning option that I
could set for code generation.
Thanx in advance
Bharath R
HUAWEI TECHNOLOGIES CO.,LTD.
Address: Huawei Industrial Base
Bantian Longgang
Shenzhen 518129, P.R.China
www.huawei.com
------------------------------------------------------------------------
-------------------------------------------------------------
This e-mail and its attachments contain confidential information from
HUAWEI, which
is intended only for the person or entity whose address is listed above.
Any use of the
information contained herein in any way (including, but not limited to,
total or partial
disclosure, reproduction, or dissemination) by persons other than the
intended
recipient(s) is prohibited. If you receive this e-mail in error, please
notify the sender by
phone or email immediately and delete it!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
<<inline: image001.jpg>>
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
