home *** CD-ROM | disk | FTP | other *** search
- .RP
- .TL
- YACC \- Yet Another Compiler-Compiler
- .AU
- Stephen C. Johnson
- .AI
- .MH
- .AB
- Computer program input generally has some structure;
- in fact, every computer program which does input can be thought of as defining
- an ``input language'' which it accepts.
- The input languages may be as complex as a programming language, or as simple as
- a sequence of numbers.
- Unfortunately, standard input facilities
- are restricted, difficult to use and change,
- and do not completely check their inputs for validity.
- .PP
- Yacc provides a general tool for controlling
- the input to a computer program.
- The Yacc user describes the structures
- of his input, together with code which is to be invoked when
- each such structure is recognized.
- Yacc turns such a specification into a subroutine which may
- be invoked to handle the input process;
- frequently, it is convenient and appropriate to have most
- of the flow of control in the user\'s application
- handled by this subroutine.
- .PP
- The input subroutine produced by Yacc calls a user supplied routine to
- return the next basic input item.
- Thus, the user can specify his input in terms of individual input characters, or, if he wishes,
- in terms of higher level constructs such as names and numbers.
- The user supplied routine may also handle idiomatic features such as
- comment and continuation conventions, which typically defy easy specification.
- .PP
- Yacc is written in C[7], and runs under UNIX.
- The subroutine which is output may be in C or in Ratfor[4], at the user\'s choice;
- Ratfor permits translation of the output subroutine into portable Fortran[5].
- The class of specifications accepted is a very general one, called LALR(1)
- grammars with disambiguating rules.
- The theory behind Yacc has been described elsewhere[1,2,3].
- .PP
- Yacc was originally designed to help produce the ``front end'' of
- compilers; in addition to this use, it has been successfully used in many application
- programs, including a phototypesetter language, a document retrieval system,
- a Fortran debugging system, and the Ratfor compiler.
- .AE
-