[antlr-interest] Re: PERL VS ANTLR

sudip mitra s_mitra8 at yahoo.com
Wed Jan 29 19:47:25 PST 2003


think abt this 
line 1- donald/45/ title /$78900
line2- mcdonald/ 67/ t............i......tles/ $890
line3- 456 billgates/32/smartest ass ever/$ 8900000
well what has happened is 890456 is gone onto line three and is between two slashes still ... so I was wondering and wondering what would Perl do here ....
 
 sudip mitra <s_mitra8 at yahoo.com> wrote:
I am comparing ... want to put on the tutorial as to what else smart things we can do using ANTLR ... always looked powerful to me... 
 "cintyram <cintyram at yahoo.com>" <cintyram at yahoo.com> wrote: i am sure perl can be used for this ..
you simply have to match every thing between a specified number of
slashes .. doesnt matter even if it is a newline ;
also perl allows you to red the whole file as one string ;
and you can do such gymnastics;
ofcourse it is easy to write an antlr grammar for this too; 
are you just comparing or really trying to solve the problem ?
cheers
ram

--- In antlr-interest at yahoogroups.com, sudip mitra wrote:
> 
> I had this data format for a text file director/ age /title
/remuneration in one part of the file ... here is the interesting part :
> donald / 34/ ceo,cfo, this,that / $4578900 
> mcdonald/67/
titles......................................................titles
........still more titles/ $567888
> the first one is a nice line delimited very well with '/' and so
easy pickings by simple file i/o
> the second line which follows it and occupies the next line for the
same format... this is the problem ..so can perl solve this ??? or
ANTLR is better ...(I am not using it as a language blah blah ....:-) )
> 
> Terence Parr 
wrote:
> On Wednesday, January 29, 2003, at 11:10 AM, cintyram 
> wrote:
> 
> > you are right, and i stand corrected ;
> > my answer was not comprehensive enough to state that antlr does not
> > support all cfgs but only predicated LL ; on the other hand , though i
> > must admit to my being not the expert on this, LR grammars can be
> > represented by an equivalent LL grammar ;
> > i remember having done some exercises on this in the compiler theory
> > class ;
> 
> Actually LR(k) is only as strong as LL(k) if you put actions on the 
> left-edge of every production, forcing the LR parser to know where it's 
> at on the left-edge just like an LL(k) parser.
> 
> The thing to remember is that all languages are "turing complete" so 
> can implement pretty much anything, however, you should focus on 
> efficiency of expression. ANTLR is a domain-specific language designed 
> to make building parsers/translators easier. PERL for the most part 
> makes you implement parsers by hand. Also, isn't PERL optimized to 
> work on a line-by-line basis? Can it easily match an HTML tag, for 
> example, spanning 5 lines?
> 
> Ter
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Lecturer in Comp. Sci., University of San Francisco
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 
> 
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030129/3a1c87fa/attachment.html


More information about the antlr-interest mailing list