[J3] Project on sourceforge
Van Snyder
van.snyder at sbcglobal.net
Fri Feb 4 04:21:43 UTC 2022
For my own use during the last forty years or so, I developed an LR
parser generator, based upon one written in Fortran 77 by Alfred
Shannon when he was Charles Wetherell's student at UC Davis.
It uses David Pager's algorithm that generates the smallest possible
PDA consistent with LR(1). It can generate a PDA that is larger than an
SLR(1) or LALR(1) parser, if that's necessary, which makes it a bit
easier to write a grammar. It generates an SLR(1) or LALR(1) parser if
the grammar is in that category.
I upgraded it to Fortran 2003, and made it easy to use.
I added generation of states to support Tom Pennello's Forward Move
Algorithm. A transcription of Pennello's paper from POPL 5 is included.
To go with the LR generator, I wrote a lexer generator.
The programs use parsers and lexers generated by themselves, so the
codes necessarily include an infrastructure to support them.
Their outputs are Fortran "include" files that consist of declarations
of enumerators and named constants.
I've used these codes in numerous projects. The first was participation
in toolpack in 1979, but toolpack ended up being Lee Osterweil's
private project. Then I used the parser generator as part of the
materials I gave students when I taught compiler methodology, initially
as a first-year graduate class, later as a senior-level undergraduate
class as the capstone of the software engineering course sequence. The
biggest project was the data analysis programs for the Microwave Limb
Sounder. The largest of those, about 350,000 lines, reads a
configuration file of about 20,000 lines. It converts the configuration
file to an abstract syntax tree in a few seconds, and then traverses
that tree to execute the program, which usually runs for fifteen hours
per day on a 384-core cluster to process about 500 million measurements
and produce about five million values of concentrations of about
fifteen minor atmospheric constituents, plus temperature and water
vapor, on 3,500 profiles at 72 pressure levels from 8 to 80 kilometers.
See http://mls.jpl.nasa.gov. The "little language" of the configuration
file has a syntax reminiscent of IDL, but it's strongly typed, and
includes units checking and conversion. I published a paper about this
in 2008 in Software Practice & Experience, entitled "The benefits of
posing application software as a language interpreter."
The codes are available now
from https://sourceforge.net/projects/lr-and-lex-gen-fortran/
I'll be gradually adding more documentation, but I don't have any new
near-term projects for the code. I might add support for regular right-
part grammars some day, but not soon.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220203/632332c6/attachment-0001.htm>
More information about the J3
mailing list