[antlr-interest] Why ANTLR 2.x?

John D. Mitchell johnm-antlr at non.net
Wed Jan 8 10:14:47 PST 2003


>>>>> "ksvanhorn" == ksvanhorn <kevin vanhorn at ndsu nodak edu> <kevin.vanhorn at ndsu.nodak.edu> writes:
[...]
> I am planning to use PCCTS 1.33 in a compiler course I am teaching.

I've used both for a long time. [Wow, has it really been a decade?]

What's the nature of your course?  I.e., is it a basic undergraduate
introduction to languages and translators (grammars, LR, pred-LL(k),
lexing, syntax directed translation, etc.) or is it more of a graduate
level course (multi-phasic, IR building and optimization, code generation,
etc.)?


> The reasons I am using this instead of ANTLR 2.x are

> - PCCTS 1.33 comes standard with RedHat Linux 7.3.

So? Antlr is a free download. 


> - PCCTS 1.33 has a comprehensive manual (Language Translation Using PCCTS
> and C++), whereas ANTLR 2.x has no such comprehensive documentation, to
> my knowledge.

Hmm... Is the PCCTS book even still in print and available?

Have you looke at the antlr.org web site?  There's documentation, examples,
the FAQ on the site and then there's this mailing list.


> - ANTRL 2.x is a Java application.  It has been my experience that Java
> apps are painfully slow, awkward to use, and difficult to install.  (I
> always run into problems with having the right version of Java required
> for an app, and then you have to worry about getting CLASSPATH set
> correctly, etc.)

Sounds like you're stuck in C-land. :-)  Trying moving up to Java v1.4.1.

Personally speaking, I'm a bit scared of programmers who (try to) write
translators but can't be relied upon to install the necessary toolchains
(whether that's GCC + flex + yacc + homegrown or GCC + pccts + sorcerer or
Java + Antlr).

In terms of "benchmark" performance, the speed differences really depend on
what you're doing -- Swing-based GUI application in Java tend to really
suck performance-wise (unless y'all are running Mac OS/X machines -- which
has hardware-accelerated drivers for Swing :-).  For me, in building real
translators, the productivity gains in using Java vastly outweigh any
purported performance differences.  [ObKnuth: "Premature optimization is
the root of all evil in computer science."]


> Are there any compelling reasons to use ANTRL 2.x over 1.33?

The (vast?) majority of people available to help, including Ter, are using
Antlr rather than the old PCCTS stuff.

Garbage-collection.  Java has it, plain C doesn't.

Antlr also has support for writing your code in Java or C++ or... Which
would give you or your students the flexibility to choose which one they'd
e.g., feel more comfortable using.  More work for the graders but I've
always found that flexibility to be particularly nice in courses.  As the
instructor, this is an easy lead-in to interoperability. :-)


IMHO, the only reason to use the old PCCTS stuff is if you want to really
get into hoisting and that's a weak argument.

Hope this helps,
		John

 

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



More information about the antlr-interest mailing list