[antlr-interest] Optimized code generation

Indhu Bharathi indhu.b at s7software.com
Fri Sep 11 00:36:08 PDT 2009


ABNF is documented here: http://en.wikipedia.org/wiki/Augmented_Backus
<http://en.wikipedia.org/wiki/Augmented_Backus%E2%80%93Naur_Form> -Naur_Form

 

You will first have to understand the differences and convert in to a LL
ANTLR grammar.

 

I'm not sure but ABNF might allow left recursion. In that case you need to
remove left recursions from the grammar. There are standard methods to do
it. Here is the theory behind it :
http://www-und.ida.liu.se/~TDDA89/Notes/left.rec.pdf. And here is an article
from ANTLR wiki:
http://www.antlr.org/wiki/display/ANTLR3/Left-Recursion+Removal+-+Print+Edit
ion

 

Replacing backtracking by Left factoring can also be done very
methodologically. You just have to remove the necessity for infinite
lookahead. Refer
http://www.cse.iitk.ac.in/research/mtech1998/9811115/node29.html to
understand what left factoring is.

 

If you still have doubts, send us a small segment that you are not able to
left factor along with what you have tried. 

 

Regards,

Indhu

 

PS: Please address the mail to the group to get quicker and better replies.

 

 

 

From: Bharath R [mailto:r.bharath at huawei.com] 
Sent: Friday, September 11, 2009 11:47 AM
To: 'Indhu Bharathi'
Subject: RE: [antlr-interest] Optimized code generation

 

Hi , 

 

Thanx a lot for ur reply. 

 

Sorry for asking the question on basic of ANTLR , could you pls tell me how
should I left factor my grammar. 

 

Currently I am working in SIP Protocol , where the RFC 3966 defines the TEL
URI Grammar in ABNF format. 

This format need to be converted into the parser understandable way. 

 

So I have used antlrworks for writing my grammar file.

 

And eventually end up with a complex state where I could not able to compile
the grammar without "backtrack=true". 

 

 

Regards

Bharath R 

HUAWEI TECHNOLOGIES CO.,LTD. huawei_logo


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!

 

 

  _____  

From: Indhu Bharathi [mailto:indhu.b at s7software.com] 
Sent: Thursday, September 10, 2009 10:37 PM
To: r.bharath at huawei.com; 'antlr-interest'
Subject: RE: [antlr-interest] Optimized code generation

Yes, backtracking will affect performance. If you are concerned about
performance, don't use backtrack and try left factoring your grammar
instead. 

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Bharath R
Sent: Thursday, September 10, 2009 5:25 PM
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. huawei_logo


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!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090911/e42cc738/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 6737 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090911/e42cc738/attachment.jpe 


More information about the antlr-interest mailing list