[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to construct a BNF for a language mechanically and incrementally
Re: How to construct a BNF for a language mechanically and incrementally?
30 Dec 2009 05:17:49 -0000
>I just start reading the book "flex & bison Text Processing Tools" by
>John Levine. Please excuse me if I ask some question that are
>available somewhere in the book. When the grammar become huge, it
>would be inconvenient put all BNFs in a single file. I'm wondering how
>a huge grammar is handled in bison?
Slowly. Bison has no built in provision for handling multiple source
files, but it's easy enough to use something like soelim in your
Makefile to combine several files into one and hand it to bison.
>> For some languages, like Fortran, Bison/Flex are not a good at all.
Scanning Fortran with flex would be a losing battle, but once you have
a scanner, parsing it with bison isn't hard. Here's a scanner and
parser for most of Fortran 77 that I wrote 20 years ago: