🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #159

Re: Comment delimiters

#159
From: George Neuner
Date: Fri, 16 Oct 2026 22:57
68 lines
4714 bytes
On Fri, 16 Oct 2026 17:10:24 GMT, anton@mips.complang.tuwien.ac.at
(Anton Ertl) wrote:


>As for convenience, for various compilers I read that either the
>scanner or the parser (or both) were hand-written (I don't remember
>which one was more frequent).  

Scanners.  Parser are a lot of work.

> It certainly does not seem much work to
>write a scanner for a typical programming language by hand (you
>recognize keywords by table lookup of things that will be classified
>as identifiers if they are not in the table).  For the parser of a
>language that is not LL(1), it's more work, but writing it by hand
>allows you to do various things that, e.g., bison does not support

Bison is limited to single (token) lookahead, but since it can
backtrack, and also create LR(1), SLR(1), and GLR(1) parsers as well
as the (yacc-alike) LALR(1) ... well, I've never actually encountered
a situation that Bison couldn't be contorted into handling.
[Of course the contortions required can make the grammar feel
unnatural.]

And Bison doesn't generate lexers (scanners) so they have to be
provided separately.


>(ANTLR has support for "syntactic predicates" and "semantic
>predicates", which probably is good enough for a lot of cases; it was
>written with C++ in mind).

Again, I've never encountered any situation ANTLR can't handle.  ANTLR
can generate both parsers and lexers (scanners), and because they are
recursive descent they tend to be easier to debug (when necessary)
than are Bison/Flex state machines.


Early versions of ANTLR were LL(k): you had to specify the maximum
lookahead required by any rule in your grammar else the parser would
not work correctly [if it could be generated at all].

Starting from version 3, ANTLR became LL(*) which has per-rule
lookahead figured out by the tool.  LL(*) is easier to use, but its
grammars are incompatible with the earlier LL(k) versions.  The LL(*)
versions support parser AND lexer in a single grammar file, whereas
the early versions required them to be separate.

Also starting from version 3, ANTLR is written in Java.  It can
generate code for different target languages (and there are runtime
libraries available for the various targets), but the tool itself
requires a JVM to execute.


Current version is 4.13.2.

I keep 2.7.7 around for Windows and Linux specifically because it was
NOT written in Java. Being LL(k), it is a bit harder to use, and it
targets only C or C++, but AFAIK it is the last version of ANTLR to be
available as a simple executable rather than a jar.


[I am aware that Java programs (at least theoretically) can be
compiled directly to executable. B ut I don't know offhand what Java
compilers can do that, and AFAICT nobody has done it for any modern
versions of ANTLR.

If anybody knows differently, I'm happy to hear that I'm mistaken.]
Technical Details
Message-ID: <1c65dltft4kmmi33gt0cshb2tbhmrari4b@4ax.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11aig3c$3hdcn$1@dont-email.me> <11aiqc0$3kr94$3@dont-email.me> <179190779286.25645.14465927900754526737@media.vsta.org> <179190779286.25645.14465927900754526737@media.vsta.org> <vandys@vsta.org> <jwvjynl2cg0.fsf-monnier+comp.arch@gnu.org> <808vclt9i2mso89n1itvnvos5j88g1mopl@4ax.com> <6acfc2b2.1547984@news.eternal-september.org> <HZQzS.6$TYg.3@fx21.iad> <2026Oct15.081750@mips.complang.tuwien.ac.at> <11asgjl$328d5$1@dont-email.me> <2026Oct16.191024@mips.complang.tuwien.ac.at>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.arch
Subject: Re: Comment delimiters
Date: Fri, 16 Oct 2026 18:57:53 -0400
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <1c65dltft4kmmi33gt0cshb2tbhmrari4b@4ax.com>
References: <11aig3c$3hdcn$1@dont-email.me> <11aiqc0$3kr94$3@dont-email.me> <179190779286.25645.14465927900754526737@media.vsta.org> <179190779286.25645.14465927900754526737@media.vsta.org> <vandys@vsta.org> <jwvjynl2cg0.fsf-monnier+comp.arch@gnu.org> <808vclt9i2mso89n1itvnvos5j88g1mopl@4ax.com> <6acfc2b2.1547984@news.eternal-september.org> <HZQzS.6$TYg.3@fx21.iad> <2026Oct15.081750@mips.complang.tuwien.ac.at> <11asgjl$328d5$1@dont-email.me> <2026Oct16.191024@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 16 Oct 2026 22:57:56 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3921292"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/673t+rYXi+tf940tif6+5iFfp2H0vFIk="; posting-host="765f4d2e14ec97832a571fc40bcbf3cb"
User-Agent: ForteAgent/8.00.32.1272
Cancel-Lock: sha1:Os6YQaSMBK1lgpaxtbhx7XbB8gc= sha256:tm3D9X7tbiTXB8raE2cSFI36QCYTwVtDPdy7zxGih28=
	sha1:Rm6hHKIyaT99d3gdHZsH1duEMzs= sha256:wjA2dACvDqJb77Stgpy7OQqFRPNhBjzIiJPxpDwwS+k=
X-Received-Bytes: 4518