Related articles |
---|
Object Oriented Lexing and Parsing compres!bz@crackers.clearpoint.com (1991-08-24) |
Newsgroups: | comp.lang.c++,comp.compilers |
From: | compres!bz@crackers.clearpoint.com (Barbara Zino) |
Keywords: | OOP, parse |
Organization: | Compilers Central |
Date: | Sat, 24 Aug 91 18:22:22 EDT |
> [Last month someone asked about C++ yacc and lex with no response.
> Steve Johnson discussed his Y++ at the Spring 88 EUUG. A commercial
> product called yacc++ was discussed in March but doesn't seem to be
> particularly OOP. . . . -John]
Ouch!! I guess that will teach me to keep up with Usenet! Please
post my Yacc++ self-defense!!!
Yacc++ (tm) and the Language Objects Library from Compiler Resources
is an object oriented lexer and parser generator.
- Yacc++ generates lexer and parser objects. Each lexer and parser
is an abstract data structure containing the entire state. The lexer
and parser engines are member functions which are shared by the
objects, but have no internal state. You can have as many lexer or
parser objects instantiated at runtime as needed by your application.
- Yacc++ supports classes via the CLASS declaration. This supports
multiple lexers and parsers. When the grammars are translated to
C++, they are output as C++ classes. The lexers and parsers are
automatically named with the class names from the grammar, preventing
name clashes. In C, macros provide equivalent functionality.
- Yacc++ supports inheritance through the FROM declaration. Grammars
may inherit productions from other class grammars allowing construction
of language families. Each grammar may also have multiple entry points
via the PUBLIC declaration.
- The Language Objects Library supports dynamic binding. The lexer
and parser can be selected at runtime and the association between
lexer and parser can be changed mid-parse.
- The Language Objects Library supports polymorphism. The same
interface is used for all lexers and for all parsers. The lexer
and parser objects, not the lexer and parser engines, contain the
class information. Calls to the member functions determine the class
from the lexer or parser object.
- The Language Objects Library also provides file and symbol table
objects per lexer and parser object. This supports the syntax directed
object design model.
See Jack Crenshaw, "A Perfect Marriage : Syntax Directed Design",
Computer Language, June 1991, pages 44-55.
- The Language Objects Library supports a call-back mode where the engines
run as coroutines for use in event driven systems such as GUI's. The
member functions yy_lex_pause() and yy_lex_resume() support incremental
parsing of multiple files.
- Yacc++ supports finite state machines and directly translates regular
expressions into an efficient implementation.
See J. E. Grass, Chandra Kintala and Ravi Sethi,
"Object-oriented Redesign using C++",
Usenix C++ Conference Proceedings, April 1990, pages 75-86
- Yacc++ is a complete rewrite of Lex and Yacc. Besides the object
oriented features, it also contains other new stuff such as automatic
keyword definitions, minimal state LR(1) table generation, and syntax
assist error diagnostics.
> From: whatis@gnu.ai.mit.edu (Steve Boswell)
> Subject: C++ Yacc & Lex
>
> Does anyone know of any C++ parser generators? I've seen bison++ but
> I was looking more for something that made every nonterminal its own
> class and a work-along Lex with all possible types for yylval as derived
> from the YYSTYPE class. Has anyone seen such a beast, or is someone
> working on one?
We are currently working on supporting the definition of non-terminals
in the grammar as classes. This is the functionality Stephen Johnson
proposed in his "Yacc Meets C++" paper about y++. We like the approach
and will release it in Yacc++ Revision 2.0. This version will be
shipped free of charge to all current Yacc++ customers.
See Stephen Johnson, "Yacc Meets C++",
Computing Systems, Vol I, No. 2, Spring 1988
> From: johnt@meaddata.com (John Townsend)
> Subject: Yacc++
>
> An article from the May 1991 SunWorld called "The Domino Effect: Parsing
> and Lexing Objects with Yacc++" came across my desk today, and I'm
> interested in knowing how we can obtain this product or a similar
> object-oriented scanner and parser for C++. Is it a commercial product
> or public domain?
Yacc++ and the Language Objects Library is a commercial product
available only from Compiler Resources. (it is *not* shipped with Sun
Microsystems' C++ compiler).
Compiler Resources, Inc. email : crackers.clearpoint.com!compres!bz
3 Proctor Street voice : (508) 435-5016
Hopkinton, MA 01748 fax : (508) 435-4847
Ask for Barbara Zino or Chris Clark if you need technical information.
A single user license for a Sparc or Sun-3 is $995. Multiple copy and
site licenses are available at discounted prices. Academic users receive
a 50% discount. License fees are a one time cost. There are no additional
licensing fees for products built with Yacc++. The current maintenance
service contract is 15% of the license fee.
Yacc++ comes with the Language Objects Library, a 400 page manual, and
over 75 executable tutorial programs. Makefiles for various C++ and C
compilers are included.
See Barbara Zino, "The Domino Effect: Parsing and Lexing Objects with
Yacc++", SunWorld, May 1991, pages 86-92
*************************** IMPORTANT NOTES ****************************
The OS/2 beta version of Yacc++ and the Language Objects Library will
be available in September. The cost is $695. Please contact us if
you want to be shipped the beta version. Our beta policy is that you
will automatically receive free updates up to and including the FCS
version.
Also -- we hope to see you in Phoenix at OOPSLA! Chris and I will be
doing a demo of Yacc++ and the Language Objects Library as part of the
OOPSLA program, currently scheduled for Tuesday, October 6th at 5:15
and Wednesday, October 7th at 9:30. Compiler Resources will be set up
in the Exhibition Hall at Booth 212 all week so please drop by to say
hello and check out Yacc++.
*****************************************************************************
Barbara Zino email : crackers.clearpoint.com!compres!bz
Compiler Resources, Inc. voice : (508) 435-5016
3 Proctor Street fax : (508) 435-4847
Hopkinton, MA 01748
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.