Re: Has anyone hand-written a scanner/parser module?

arnold@skeeve.com (Aharon Robbins)
Tue, 18 Nov 2008 05:20:21 +0000 (UTC)

          From comp.compilers

Related articles
[8 earlier articles]
Re: Has anyone hand-written a scanner/parser module? idbaxter@semdesigns.com (Ira Baxter) (2008-11-16)
Re: Has anyone hand-written a scanner/parser module? rajamukherji@gmail.com (Raja Mukherji) (2008-11-16)
Re: Has anyone hand-written a scanner/parser module? bill@qswtools.com (Bill Cox) (2008-11-16)
Re: Has anyone hand-written a scanner/parser module? marcov@stack.nl (Marco van de Voort) (2008-11-17)
Re: Has anyone hand-written a scanner/parser module? dmaze@mit.edu (David Z Maze) (2008-11-17)
Re: Has anyone hand-written a scanner/parser module? gene.ressler@gmail.com (Gene) (2008-11-17)
Re: Has anyone hand-written a scanner/parser module? arnold@skeeve.com (2008-11-18)
Re: Has anyone hand-written a scanner/parser module? sh006d3592@blueyonder.co.uk (Stephen Horne) (2008-11-18)
Re: Has anyone hand-written a scanner/parser module? charlesb.cca@mpowercom.net (Charles E. Bortle, Jr.) (2008-11-18)
Re: Has anyone hand-written a scanner/parser module? r3jjs@yahoo.com (Jeremy J Starcher) (2008-11-19)
Re: Has anyone hand-written a scanner/parser module? armelasselin@hotmail.com (Armel) (2008-11-19)
Re: Has anyone hand-written a scanner/parser module? bobduff@shell01.TheWorld.com (Robert A Duff) (2008-11-23)
Re: Has anyone hand-written a scanner/parser module? bobduff@shell01.TheWorld.com (Robert A Duff) (2008-11-23)
[5 later articles]
| List of all articles for this month |

From: arnold@skeeve.com (Aharon Robbins)
Newsgroups: comp.compilers
Date: Tue, 18 Nov 2008 05:20:21 +0000 (UTC)
Organization: Pioneer Consulting, Ltd.
References: 08-11-061 08-11-079
Keywords: parse, practice
Posted-Date: 18 Nov 2008 19:10:16 EST
Originator: arnold@skeeve.com (Aharon Robbins)

"tuxisthebirdforme@gmail.com" <tuxisthebirdforme@gmail.com> writes:


> I know most people anymore use lex/yacc or some derivative of these
> tools to create scanner/parser modules for their compiler projects. I
> was wondering if anyone has developed a scanner or parser that they
> personally hand-wrote? If so, I would like to know what language you
> used and what type of grammar you parsed.


The scanner in GNU Awk (gawk) is hand-written, for a yacc parser. Gawk
builds a parse tree and then recursively evaluates it for each input
record. The lexer builds identifiers and then binary searches a table
indicating what kind of identifier it is (keyword, builtin function),
and if the identifier isn't found in the table, then it returns IDENTIFIER
to the parser.


Unix Awk ("the one true awk") is available from Brian Kernighan's home
pages at Bell Labs and Princeton. Some years ago he rewrote the lexer
from lex into hand-written C. A few bugs were introduced along the way
although there was definitely a portability gain, since the original
awk was pretty intimate with the lex internals. His CHANGES file makes
interesting reading.


Hope this is of interest,
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.