Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

yacc(1) [v7 man page]

YACC(1) 						      General Commands Manual							   YACC(1)

NAME
yacc - yet another compiler-compiler SYNOPSIS
yacc [ -vd ] grammar DESCRIPTION
Yacc converts a context-free grammar into a set of tables for a simple automaton which executes an LR(1) parsing algorithm. The grammar may be ambiguous; specified precedence rules are used to break ambiguities. The output file, y.tab.c, must be compiled by the C compiler to produce a program yyparse. This program must be loaded with the lexical analyzer program, yylex, as well as main and yyerror, an error handling routine. These routines must be supplied by the user; Lex(1) is useful for creating lexical analyzers usable by yacc. If the -v flag is given, the file y.output is prepared, which contains a description of the parsing tables and a report on conflicts gener- ated by ambiguities in the grammar. If the -d flag is used, the file y.tab.h is generated with the define statements that associate the yacc-assigned `token codes' with the user-declared `token names'. This allows source files other than y.tab.c to access the token codes. FILES
y.output y.tab.c y.tab.h defines for token names yacc.tmp, yacc.acts temporary files /usr/lib/yaccpar parser prototype for C programs /lib/liby.a library with default `main' and `yyerror' SEE ALSO
lex(1) LR Parsing by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974. YACC - Yet Another Compiler Compiler by S. C. Johnson. DIAGNOSTICS
The number of reduce-reduce and shift-reduce conflicts is reported on the standard output; a more detailed report is found in the y.output file. Similarly, if some rules are not reachable from the start symbol, this is also reported. BUGS
Because file names are fixed, at most one yacc process can be active in a given directory at a time. YACC(1)

Check Out this Related Man Page

yacc(1) 						      General Commands Manual							   yacc(1)

Name
       yacc - yet another compiler-compiler

Syntax
       yacc [-vd] grammar

Description
       The command converts a context-free grammar into a set of tables for a simple automaton which executes an left recursive parsing algorithm.
       The grammar may be ambiguous; specified precedence rules are used to break ambiguities.

       The output file, must be compiled by the C compiler to produce a program yyparse.  This program must be loaded with  the  lexical  analyzer
       program,  yylex, as well as main and yyerror, an error handling routine.  These routines must be supplied by the user; is useful for creat-
       ing lexical analyzers usable by

Options
       -d Writes all define statements to file.  This allows source files other than to access the token codes.

       -v Writes description of parsing tables and report of grammatical conflicts to file.

Diagnostics
       The number of reduce-reduce and shift-reduce conflicts is reported on the standard output; a more detailed report is  found  in	the  Simi-
       larly, if some rules are not reachable from the start symbol, this is also reported.

Restrictions
       Because file names are fixed, at most one process can be active in a given directory at a time.

Files
       y.output
       y.tab.c
       y.tab.h		   defines for token names
       yacc.tmp, yacc.acts temporary files

See Also
       lex(1)
       "YACC - Yet Another Compiler Compiler" ULTRIX Supplementary Documents Vol. II:Programmer

																	   yacc(1)
Man Page

10 More Discussions You Might Find Interesting

1. Programming

cc option

my yacc output file y.tab.c is not compiling using cc y.tab.c -ly command .possibily option flag -ly is not correct.i m using red hat linux 9.please give solutions. (4 Replies)
Discussion started by: kuldeep_bora
4 Replies

2. Shell Programming and Scripting

using sed

Hi ... I have a file saju-list with the following contents Nidesh:25 Dinto:26 Johnson:28 I want to write a script to display the output like this : NAME Nidesh 25 NAME Dinto 26 NAME Johnson 28 I write my script like this : for x in $(cat /in/tmp/saju-list) do (6 Replies)
Discussion started by: sars
6 Replies

3. Shell Programming and Scripting

How to match n number of newline character(\n) in lex and yacc

(0 Replies)
Discussion started by: vishwa787
0 Replies

4. Programming

actions before parsing rules in lex n yacc

Hi , We have developed a grammer for our domain language using lex n yacc. I want to know is there any pre defined lex-yacc function which gets call before executing any rule (or rules). Oue requirement is, before processing any rule ,we want to perform some specific actions ? is there... (0 Replies)
Discussion started by: supritjain
0 Replies

5. Programming

parsing fixed length field with yacc/bison

How to specify the token length in a yacc file? sample input format <field1,data type ans,fixed length 6> followed by <field2,data type ans,fixed length 3> Example i/p and o/p Sample Input: "ab* d2 9o" O/p : "Field1 Field2 " yacc/bison grammar: record :... (1 Reply)
Discussion started by: sungita
1 Replies

6. UNIX for Dummies Questions & Answers

I dont really think that the math header has syntax errors

Hi, Mini:Evaluator develop$ make bison -d grammar.y grammar.y: conflicts: 24 shift/reduce flex rules.l cc -0 -o Evaluator grammar.tab.c lex.yy.c -ly -ll -lm In file included from grammar.y:3: /usr/include/architecture/i386/math.h:310: error: syntax error before numeric constant... (1 Reply)
Discussion started by: tcerka
1 Replies

7. Programming

Problem with Yacc

Hi guys, I'm struggling with a simple but at the same time complicated problem related to yacc :wall: Maybe someone can help me with this :confused: I'm working on a big project and it's hard for me to show the problem exactly on my code, but I will give a model of it. Before I had this kind... (2 Replies)
Discussion started by: sisi
2 Replies

8. Shell Programming and Scripting

Lex: concatenating word into array of c-strings

Alright, so I'm writing a file for the lexical analyzer (lex). It will be used to check C code (collecting the identifiers and storing those names along with the line numbers the identifier was found on). I'm not used to 'C' so I'm having some difficulty. I am using a function (insertId()) to... (4 Replies)
Discussion started by: D2K
4 Replies

9. Homework & Coursework Questions

Phases of Compilers

Hello I have a questions and m stuck on it. Theoritcally the phases of compiler. 1. Lexical analyis -- genrates tokes NOW MY QUESTION IS: where i can see these token if i make a simple C program. Please guys tell me step to see it. and other phases too. your help will be appreciated... (1 Reply)
Discussion started by: aditya08
1 Replies

10. Programming

Yacc rogram

hello, actually i want to generate rgram in yacc able to do do several operations separated by ';' and after show all the results separated by ';' again. My code do just one operations and i couldn' t find solution to do several ones separated by ';'. I thought may be i can do a do... while but i... (0 Replies)
Discussion started by: zolafencer
0 Replies