From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Tue, 28 Feb 2012 11:57:58 -0500 To: 9fans@9fans.net Message-ID: <3ab2f519d8b94b9287908779f8eba4db@chula.quanstro.net> In-Reply-To: <6111913F-25EB-4182-8E3B-357446F05655@bitblocks.com> References: <201202271323.q1RDNuL5007269@freefriends.org> <6111913F-25EB-4182-8E3B-357446F05655@bitblocks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Config File parsing Topicbox-Message-UUID: 65790bb8-ead7-11e9-9d60-3106f5b1d025 On Tue Feb 28 11:53:17 EST 2012, bakul@bitblocks.com wrote: > I have almost always used a handwritten lexer as it seemed about the > same amount of work and the end result is much smaller and easier to > understand and lexers for different languages are not all that > different so once you've written one it is pretty easy to write > another; and somehow lex or flex interface never felt quite right. for an extreme example, see /sys/src/cmd/upas/smtp/smtpd.y. imho, the trick in lexing is to do as little as possible. context rules tend to sneak in in the lex phase. for example, rc's free carets and willingness to eat newlines under rules that seem obvious until they need explaining. - erik