A C++ Parser toolkit

Mayan Moudgill <moudgill@cs.cornell.EDU>
Sun, 11 Apr 1993 02:43:30 GMT

          From comp.compilers

Related articles
A C++ Parser toolkit moudgill@cs.cornell.EDU (Mayan Moudgill) (1993-04-11)
Re: A C++ Parser toolkit parrt@ecn.purdue.edu (1993-04-12)
C++ Parser toolkit: crude mmap added. moudgill@cs.cornell.EDU (Mayan Moudgill) (1993-04-14)
| List of all articles for this month |

Newsgroups: comp.lang.c++,comp.compilers
From: Mayan Moudgill <moudgill@cs.cornell.EDU>
Summary: a toolkit for quickly implementing a parser (including CSGs)
Keywords: C++, parse, tools, comment
Organization: Cornell Univ. CS Dept, Ithaca NY 14853
Date: Sun, 11 Apr 1993 02:43:30 GMT

I've implemented a parser/scanner/text-matcher :) that allows a programmer
to quickly specify a grammar, and to attach actions to productions.

For instance, the following code:

            int name(Parse& P)
            Token t;

                    P, IDENT(t);
                    if( P && StbFind(t) ) {
                          return 1;
                    return 0;

            int stmt(Parse & P)
            Token t;

                  P, MATCH(name), "=", NUMBER(val);

matches an identifier (i.e. [a-zA-Z_][a-zA-Z_0-9]*), '=', number string,
but only if identifier is already in the symbol-table.

NOTES: It works on a Sun 4.0 with C++ 3.0. It _MIGHT_ work on some other OSes
I've used mmap() to implement it. Your OS might have the function;
then again it might not. Even if it does, its parameters might not be
the same.

PS. Its also ftp'able as pub/Parse.shar from ftp.cs.cornell.edu

[I've put this in the compilers FTP archives at primost.cs.wisc.edu as
c++kit.Z. If you can't FTP, it's available by e-mail from the mail server
at compilers-server@iecc.cambridge.ma.us; send "send c++kit" to retrieve it.
Please FTP if you can, the mail server is linked to the outside world by a
single dial-up modem. -John]

Post a followup to this message

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