LEX/YACC - grammar problems and printing error messages

nett@technix.mn.org (Jerry Nettleton)
Thu, 28 May 1992 03:51:14 GMT

          From comp.compilers

Related articles
LEX/YACC - grammar problems and printing error messages nett@technix.mn.org (1992-05-28)
Re: LEX/YACC - grammar problems and printing error messages johnl@iecc.cambridge.ma.us (1992-05-28)
Re: LEX/YACC - grammar problems and printing error messages craig@comp.lancs.ac.uk (1992-05-29)
Re: Lex/Yacc error reporting quanstro@stolaf.edu (1992-05-29)
LEX/YACC - grammar problems and printing error messages thiemann@informatik.uni-tuebingen.de (1992-06-02)
| List of all articles for this month |

Newsgroups: comp.unix.programmer,comp.compilers
From: nett@technix.mn.org (Jerry Nettleton)
Keywords: yacc, lex, errors
Organization: Technix, Inc.
Date: Thu, 28 May 1992 03:51:14 GMT

I have been developing a data conversion program using lex and yacc in
order to generate a text file to import into a new database. (I know AWK
could be used, but I want to adapt this conversion process for an
interactive mode.) As grammar errors are found, I was wondering how to
associate the source line/column with an appropriate error message. Since
lex deals with tokens and yacc parses the grammar, how can I get the
current line of input to print error messages? Actually, the data is
organized as a multi-line record and I will write the entire record to an
error file and then use a comment line to display the error.


--
Jerry Nettleton
email: nett@technix.mn.org
              ...!uunet!cs.umn.edu!kksys!edgar!technix!nett
[Bison has some extra hackery to associate a line and column number with
every token, though it still won't give you the whole line. See the next
message for some suggestions. -John]
--


Post a followup to this message

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