[antlr-interest] Re: PERL VS ANTLR

Brian Smith brian-l-smith at uiowa.edu
Tue Jan 28 21:12:58 PST 2003


ANTLR doesn't support really support just any context free grammars. It 
handles predicated LL(k) grammars. Because of the LL(k), it cannot 
handle all context free grammars. Yet, because of the predicates, it can 
handle some grammars that are not context free, given the proper 
predicates. [Hmm, I wonder, if there is a mechanical transformation of 
LR(k) or GLR grammars to predicated LL(k) grammars?]

Also, Perl doesn't just handle regular grammars because Perl's "regular 
expressions" are really not "regular;" they are much more powerful. It 
is my understanding that in Perl 6, there is even a way to write Perl 
"regular expressions" in an EBNF style that is similar to the style used 
in parser-generator systems like ANTLR and YACC. I believe that Perl 
also has something analogous to ANTLR's predicates. I would be very 
interested to read a paper that attempts to define the class of grammars 
that Perl's "regular expressions" can handle.

Personally, I wouldn't use Perl for any situation for which the input is 
likely to contain syntax errors that I would be required to report on 
(e.g. a compiler). I would generally use Perl for cases where I could 
assume that the input is well-formed, and/or situations where I can 
ignore and easily recover from syntax errors (e.g. log files). But, 
maybe that just evidence of my lack of experience with Perl.

- Brian

sudip mitra wrote:
> wow ...!!! some explanation ... you think very clearly !!!
> 
>  */"cintyram <cintyram at yahoo.com>" <cintyram at yahoo.com>/* wrote:
> 
>     well , in principle, antlr supports context free , which is a super
>     set of regular ;
>     but perl is a programming languge and helps you in doing specific
>     tasks which might be part of your solution, like making it easy to
>     read a file, etc .. also the pattern matching and other r.e functions
>     are very powerful and sufficient for most common tasks; for eg: if all
>     you have to do is read links out of a file, or simply search and
>     replace a specific patter with a specific other .. then perl might be
>     easier to use;
> 
>     on the other hand, if you try writing a system like monty's gcc
>     framework etc. in PERL you will find that it is easier to think and
>     specify in ebnf ;
>     so the comparison is actually case by case , and one should not
>     generalize ;
> 
> 
>     also with antlr, you generate code to do something, but with perl you
>     actually formulate the whole solution! and code it!!
> 
>     so your question for the most part wants to compare apples and oranges.
>     /e
>     cheers
>     ram
> 
> 
> 
>     --- In antlr-interest at yahoogroups.com, "John D. Mitchell"
>     wrote:
>      > Sounds like a troll but what the heck... :-)
>      >
>      > >>>>> "sudip" == sudip mitra writes:
>      > [...]
>      >
>      > > I was wondering how do Perl and Antlr compare . Would Antlr be a
>      > > superset of Perl ? Or is Perl THE language for text manipulation ?
>      > > Answers to this question should ignore the learning time .I just
>     want to
>      > > know if Antlr can do more than Perl even if its a language blah
>     blah
>      > > ...!!!
>      >
>      > (A) Perl is a general purpose programming language.
>      >
>      > (B) Perl programs for translation work tend very strongly to be
>     based on
>      > ad hoc, simplistic (though often ridiculously complex) use of regular
>      > expressions.
>     ! >
>      > (C) ANTLR is a grammar-based lexer/parser/walker generator.
>      >
>      > Go wild,
>      > John
> 
> 
> 
> 
>     Your use of Yahoo! Groups is subject to
>     http://docs.yahoo.com/info/terms/
> 
> 
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus 
> <http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com> - 
> Powerful. Affordable. Sign up now 
> <http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service 
> <http://docs.yahoo.com/info/terms/>.


 

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



More information about the antlr-interest mailing list