yacc first and follow set generator wanted

S Voogd <slv@seg.npl.co.uk>
Thu, 8 Nov 90 17:00:31 GMT

          From comp.compilers

Related articles
yacc first and follow set generator wanted slv@seg.npl.co.uk (S Voogd) (1990-11-08)
| List of all articles for this month |
Newsgroups: comp.compilers
From: S Voogd <slv@seg.npl.co.uk>
Keywords: yacc, question
Organization: Compilers Central
Date: Thu, 8 Nov 90 17:00:31 GMT

'allo, 'allo,


I require a program that, given the syntax of a language written in YACC,
will give a list of all tokens that can appear immediately to the right of
some given non_terminal and a list of all tokens that can appear as the
first token of that non-terminal. (The so-called FIRST and FOLLOW sets)


Maybe it is possible to derive those sets from YACC (YACC uses those sets
to fill the parse-table) but I could not find anything about it in the
manual or other books (e.g. Aho, Sethi, Ullman).


Maybe FIRST and FOLLOW sets are called otherwise elsewhere therefore I'll
explain what I mean with it.


Given the following grammar:


A : B 'c' D;
B : 'e' 'f'
    | 'g' 'h';
C : B 'i';


The First set of A is First(A) = First(B) = {'e', 'g'}
The FOLLOW set of B is Follow(B) = {'c', 'i'}




Many thanx in advance
SIMON


please send replies to : slv@seg.npl.co.uk
S. L. Voogd
NPL London UK
+81 - 943 7009
6994
[I'd think one would be able to extract the info from the y.output listing,
or else directly from the generated parse tables. -John]
--


Post a followup to this message

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