Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: George Neuner Newsgroups: comp.compilers Subject: Re: The dragon book says separating lexical analysis and parsing is beneficial, so why doesn't ANTLR separate them? Date: Sat, 11 Jun 2022 18:15:06 -0400 Organization: A noiseless patient Spider Lines: 24 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-06-040@comp.compilers> References: <22-06-023@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="13702"; mail-complaints-to="abuse@iecc.com" Keywords: design Posted-Date: 11 Jun 2022 19:38:42 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3071 On Thu, 9 Jun 2022 14:52:59 +0000, Roger L Costello wrote: >[elided quote] seem like compelling reasons for separating the lexical analysis >from parsing, so why does ANTLR not do so; i.e., why does ANTLR combine them? > >/Roger > >[1] Compilers: Principles, Techniques, and Tools by Aho, Sethi, and Ullman. Technically ANTLR does /not/ combine them ... it generates separate lexer and parser. What ANTLR /does/ do is allow specifying both the parser and lexer in a single input file. It also can recognize textual constants within the parser specification and generate lexer rules for them. Note that Yacc and Bison also recognize textual constants in the parser grammar and generate a token id for the (seperately specified) lexer to return. ANTLR goes further only because it can: ANTLR can create a lexer whereas Yacc and Bison cannot. George