]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/doc/psd/15.yacc/ss_
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / doc / psd / 15.yacc / ss_
1 .\" Copyright (C) Caldera International Inc. 2001-2002.  All rights reserved.
2 .\" 
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions are
5 .\" met:
6 .\" 
7 .\" Redistributions of source code and documentation must retain the above
8 .\" copyright notice, this list of conditions and the following
9 .\" disclaimer.
10 .\" 
11 .\" Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 
15 .\" All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" 
18 .\" This product includes software developed or owned by Caldera
19 .\" International, Inc.  Neither the name of Caldera International, Inc.
20 .\" nor the names of other contributors may be used to endorse or promote
21 .\" products derived from this software without specific prior written
22 .\" permission.
23 .\" 
24 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
25 .\" INTERNATIONAL, INC.  AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
26 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 .\" DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34 .\" OR OTHERWISE) RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
35 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .\"
37 .\"     @(#)ss..        8.1 (Berkeley) 6/8/93
38 .\"
39 .\" $FreeBSD$
40 .EH 'PSD:15-%''Yacc: Yet Another Compiler-Compiler'
41 .OH 'Yacc: Yet Another Compiler-Compiler''PSD:15-%'
42 .\".RP
43 .ND "July 31, 1978"
44 .TL
45 Yacc:
46 Yet Another Compiler-Compiler
47 .AU "MH 2C-559" 3968
48 Stephen C. Johnson
49 AT&T Bell Laboratories
50 Murray Hill, New Jersey 07974
51 .AI
52 .AB
53 .PP
54 Computer program input generally has some structure;
55 in fact, every computer program that does input can be thought of as defining
56 an ``input language'' which it accepts.
57 An input language may be as complex as a programming language, or as simple as
58 a sequence of numbers.
59 Unfortunately, usual input facilities
60 are limited, difficult to use,
61 and often are lax about checking their inputs for validity.
62 .PP
63 Yacc provides a general tool for describing
64 the input to a computer program.
65 The Yacc user specifies the structures
66 of his input, together with code to be invoked as
67 each such structure is recognized.
68 Yacc turns such a specification into a subroutine that
69 handles the input process;
70 frequently, it is convenient and appropriate to have most
71 of the flow of control in the user's application
72 handled by this subroutine.
73 .PP
74 The input subroutine produced by Yacc calls a user-supplied routine to
75 return the next basic input item.
76 Thus, the user can specify his input in terms of individual input characters, or
77 in terms of higher level constructs such as names and numbers.
78 The user-supplied routine may also handle idiomatic features such as
79 comment and continuation conventions, which typically defy easy grammatical specification.
80 .PP
81 Yacc is written in portable C.
82 The class of specifications accepted is a very general one: LALR(1)
83 grammars with disambiguating rules.
84 .PP
85 In addition to compilers for C, APL, Pascal, RATFOR, etc., Yacc
86 has also been used for less conventional languages,
87 including a phototypesetter language, several desk calculator languages, a document retrieval system,
88 and a Fortran debugging system.
89 .AE
90 .\" .OK
91 .\"Computer Languages
92 .\"Compilers
93 .\"Formal Language Theory
94 .\" .CS 23 11 34 0 0 8