Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!samsung!olivea!mintaka!spdcc!esegue!compilers-sender From: slv@seg.npl.co.uk (S Voogd) Newsgroups: comp.compilers Subject: yacc first and follow set generator wanted Keywords: yacc, question Message-ID: <2390.9011081700@lemon.seg.npl.co.uk> Date: 8 Nov 90 17:00:31 GMT Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: S Voogd Organization: Compilers Central Lines: 38 Approved: compilers@iecc.cambridge.ma.us '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] -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!esegue!compilers. Meta-mail to compilers-request.