Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!rpi!leah!bingvaxu!vu0310 From: vu0310@bingvaxu.cc.binghamton.edu (R. Kym Horsell) Newsgroups: comp.lang.c Subject: Re: lex & yacc questions Keywords: lex, yacc Message-ID: <3868@bingvaxu.cc.binghamton.edu> Date: 20 Aug 90 17:56:24 GMT References: <266@cti1.UUCP> Reply-To: vu0310@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (R. Kym Horsell) Distribution: comp Organization: SUNY Binghamton, NY Lines: 49 In article <266@cti1.UUCP> mpledger@cti1.UUCP (Mark Pledger) writes: \\\ >PROBLEM 1 ------------------------------------ :-( > >When I compile then link using the command line options below, I >always get the "environ" referencing error. The only way I've \\\ Dont know -- what does your "main" look like? Does it really have a main()? This looks like libc is trying to set up the stuff to run your program but cant find it... >PROBLEM 2 ------------------------------------ :-( > >When I run yylex() from the sample code below, if no matching integer >is found it prints the yytext[] anyway. Why? I have it doing nothing \\\ If something doesnt match any pattern it gets printed. Maybe you should have a patten at the bottom like: .|\n ; So that anything else that matches a single character will get flushed. >PROBLEM 3 ------------------------------------ :-( \\\ >and possibly the underscore. My question is this, how can you get >lex to match a reserved word you have declared, whether it's upper case >or not. For example, Unify has the reserved command word "application". \\\ There are a couple of ways here. Firstly, you can define the input() macro to call your own character- getting routine. You may also have to redefine unput() as well if your method of getting characters is significanly different from getc(). (I presume all you will do is a toupper(getc(f)) or something similar). Secondly, I understand from the ``documentation'' for Lex that you can define translate tables. This may be an ideal place to learn how to use this feature, which I've managed to avoid for a couple of decades! -Kym Horsell ===== Lexing and Yaccing for years and still sane(?)