help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another problem about the calc++ example


From: Wang Yige
Subject: Re: another problem about the calc++ example
Date: Mon, 03 Jul 2006 03:36:18 +0000

Hi,

Thanks for your reply first:)

I read the Flex manual and it defines yyin only stdio and FILE * type .

I am a beginner of BISON and there is another problem. I copy the files of Calc++ examples on Bison manual: calc++.cc ,calc++-driver.cc ,calc++-driver.hh ,calc++-parser.yy, calc++-scanner.ll
Then I try to make them as follows steps:
flex -o calc++-scanner.cc calc++-scanner.ll
bison -o calc++-parser.cc calc++-parser.yy
g++ -o calc++ calc++.cc calc++-driver.cc calc++-parser.cc alc++-scanner.cc

But when I try "flex -o calc++-scanner.cc calc++-scanner.ll" on my HP-Unix(Bison-2.3) and it occurs:
flex: can't open calc++-scanner.cc
make: *** [calc++] Error 1

Is the file "calc++-scanner.cc" the target file which should be generated by calc++-scanner.ll ? If it is , the "flex -o calc++-scanner.cc calc++-scanner.ll" didn't generate it. Then I copy this file from the ../bison-2.3/examples/calc++/ to my own directory in which calc++-scanner.ll saved . I execute "flex -o calc++-scanner.cc calc++-scanner.ll" and more errors like this occur:
calc++-scanner.cc", line 567: unknown error processing section 1
calc++-scanner.cc", line 567: bad character: *
......

I also try to make the calc++ in ../bison-2.3/examples/calc++/ with its Makefile ,but the Makefile in ../bison-2.3/examples/calc++/ is so complicated that I nearly don't know how to make it whit the Makefile:( In attachments, there are files mentioned above and the makefile of myself,would you like to check them for me ? Thank you very much !

Best Regards,
Wang Yige

From: Hans Aberg <address@hidden>
To: Wang Yige <address@hidden>
CC: address@hidden
Subject: Re: Is the const variable supported by yyin?
Date: Fri, 30 Jun 2006 19:32:59 +0200

On 29 Jun 2006, at 10:19, Wang Yige wrote:

I checked the bison manual and found there only examples of yyin is ostream type and FILE * type, does the yyin support the variable type ? I recomplied the example of rpcalc in bison manual ,if I define a const variable with char * type in main(void) and want to make the yyparse() parse it correctly, what & how should I do ?

The Bison generated parsers parses a stream of tokens. It is the lexers that feed the parsers that make use of character streams. If you use Flex to generate your lexer, you might try: Flex Help <help- address@hidden>.

  Hans Aberg



_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn

Attachment: calc++.tar.Z
Description: Unix compressed data

Attachment: calc++.rar
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]