From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <775b8d190701200108meaf9b99we39445c5dbd8bcce@mail.gmail.com> Date: Sat, 20 Jan 2007 20:08:25 +1100 From: "Bruce Ellis" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] Replacements for lex In-Reply-To: <20070120084735.GD84021@mero.morphisms.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7871fcf50701191058w7ef924cer224b9c8e4f63321b@mail.gmail.com> <20070119191241.GB17033@augusta.math.psu.edu> <7871fcf50701191126x2e2031a2v9723d52ad2db6344@mail.gmail.com> <20070120084735.GD84021@mero.morphisms.net> Topicbox-Message-UUID: 0694832a-ead2-11e9-9d60-3106f5b1d025 I taught a course in advanced compiler construction where the students were required to write a lisp interpreter in C and then write a rudimentry C compiler in their lisp. The "bits you don't have to do" included the c lex function which was presented to them in lisp as a (c:token) function. I've written a lot of lex-ers and it was just the same code again (in c) which stopped the students from spending all of their time trying to do the same in lisp. This enabled them to concentrate on the more interesting tasks (I also supplied the lisp alloc and gc code). It was a fun course and I hope things were learnt. For most stuff something like lex is fine. Have a try at getting reg-exp useable and I'll type in a lex-er faster than you can debug the reg-exps (a chore i decided was a waste of time for the course). brucee On 1/20/07, William Josephson wrote: > On Fri, Jan 19, 2007 at 02:26:47PM -0500, Joel Salomon wrote: > > >I think that most people roll their own lexical analyzers under Plan 9. > > >That's typically not too hard to do, though. > > > > That's likely what I'll do for the final project (probably yet another > > C complier, but I might try my hand with [a subset of] D), but the > > You'll learn a lot more if you don't try anything like C > let alone C++ or D. For a semester-length project, you'll > learn far more if you work on a much smaller language -- > ideally domain specific, in my opinion -- and really see it > through in detail. >