Re: Parsers, grammars and BNF

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Mon, 16 Nov 2009 00:15:33 +0000 (UTC)

          From comp.compilers

Related articles
Parsers, grammars and BNF maniac_ie@yahoo.com (maniac) (2009-11-12)
Re: Parsers, grammars and BNF herron.philip@googlemail.com (Philip Herron) (2009-11-13)
Re: Parsers, grammars and BNF gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-11-16)
Re: Parsers, grammars and BNF cfc@shell01.TheWorld.com (Chris F Clark) (2009-11-15)
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Mon, 16 Nov 2009 00:15:33 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 09-11-040 09-11-042
Keywords: parse, macros
Posted-Date: 15 Nov 2009 19:28:25 EST

Philip Herron <herron.philip@googlemail.com> wrote:


> I wouldn't worry about any particular 'formula', the way i figured out
> how to do it was just writing YACC, and reading the dragon book helped
> me a lot as well as there was an o'reilley book Lex and Yacc i have it
> here somewhere it was probably the most useful out of any it shows you
> how to think about the problem easily and well + its very short you
> only need to care about the first ~100 pages the rest is one big SQL
> implementation which just gets very specific.


Many years ago (1977) I worked on a macro-processor called STEP.
Well, someone had written it, declared it finished, and then left.
I got to test it out, try some simple and not so simple problems,
and make some improvements.


As far as I know, the manual still exists but the program itself
does not. It was written in IBM Fortran IV, or maybe standard
Fortran 66. Unlike most macro-processors which recognize patterns
in text without any context, this one pretty much allowed one to
specify the exact syntax (through the SYNTAX macro) that would
be matched, and then generate the appropriate code which would then
be passed back up the parse tree.


One that I did with it was to write a parser for IBM Fortran IV,
or as close as I could get to it. (One complication is that record
boundaries are ignored on input.) It was very easy to write the
macros directly from the BNF in the IBM Fortran syntax checker
manual. (The Fortran reference manuals don't have the BNF.)


I don't know that it ever got wide distribution, but I do wonder
if anyone might still have a copy around somewhere. Otherwise,
unlike lex/yacc, but like most macro-processors, this one
was completely interpreted.


> Although i prefer having a hand-written parser since you can Taylor it
> to be more specific to your implementation, Lex and Yacc are really
> helpful when your still prototyping your language, gives you less to
> worry about when building it.


-- glen



Post a followup to this message

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