Re: bison push parser, and autoconf

2008-03-28 Thread David Fang
wn project uses, hacked up everytime I think of a new test, and not necessarily something everyone generally wants. David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Net

Re: malloc: bison-2.1+, prototype mismatch vs. stdlib.h (C++ mode)

2007-10-20 Thread David Fang
fferent, I'm not asking for a feature of one to be ported to the other. However, for compatibility reasons, I cannot ask my users to use the experimental C++ parser, just not yet. Fang David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University h

Re: malloc: bison-2.1+, prototype mismatch vs. stdlib.h (C++ mode)

2007-10-20 Thread David Fang
utput is still supported with C++ compilation given the success I've had with it, and seeing evidence of accommodating C++ in the resulting output. (It would be a good thing to maintain!) Since this (above) seems like an easy and safe fix, I hope that it might be adopted. I can generate the pr

Re: malloc: bison-2.1+, prototype mismatch vs. stdlib.h (C++ mode)

2007-10-19 Thread David Fang
s to malloc in C++ mode. Thoughts? Actually, I misspoke about the platform: it was occuring on ubuntu6 not 7. Fang David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0?? lynx?

malloc: bison-2.1+, prototype mismatch vs. stdlib.h (C++ mode)

2007-10-19 Thread David Fang
portable. This issue is the same on at least 2.1 and 2.3. Does anyone else see this issue on ubuntu7 or other UNIX system? (Another ubuntu7 distro didn't have this issue, so I need to get more feedback from my bug reporter.) Fang David Fang Computer Systems Laboratory Electri

Re: Bison error

2007-04-21 Thread David Fang
> > When i run my parser on a VRML 2.0 file > > or the DIVE VRML 1.0 parser on a VRML 1.0 file, > > i get the following error, which is not too > > informative: > > > > redblue.wrl:5: Error: > > syntax error before '?' > > > > How can i get these error messages more informative, > > for example ho

Re: Fwd: Are Google summer of code 2006 ideas still available?

2007-04-04 Thread David Fang
be made easier by exposing some sort of meta-skeleton, whereby the pieces of the generated parser can be expressed as a framework and pieced together using per-language templates. The common work of computing state transition tables can be done in a front-end, like the old y.tab.cc. Each "back-e

Re: C versus C++ parser performance

2007-02-15 Thread David Fang
stomized allocator (e.g. pool-allocator) to the container type, you can get significant speedup. Also, std::vector has a useful reserve() member function that allows you to pre-allocate memory, which can reduce expensive reallocations as a result of push_back(). HTH, Fang David Fang

Re: Deallocations upon parse errors?

2007-01-16 Thread David Fang
> Pick down some later version of Bison (2.3+); then, if you use the C > parser, there is a %destructor command, that can be used to handle > clean-up during error recovery. Another way is to use a C++ parser, > and a semantic type that does cleanup via the C++ language, but one > cannot then use %

RE: re-entrant parser scanner "%pure-parser g++

2006-12-28 Thread David Fang
> I tried before your solution using a common .h file for .lex and .yacc, > however since I'm using "%pure-parser" in my .yacc, the YYSTYPE used in > "yylex" proto is not visible to the .h itself. Hi, If you pass '-d' to bison, it should produce a header file with enumerations and the definition

Re: re-entrant parser scanner "%pure-parser g++

2006-12-28 Thread David Fang
> bison --debug -px -o x.c -dv x_yacc.c > g++ -c -o x_yacc.o x_yacc.c > > I got a compilation error: > > x_yacc.c: In function `int x_parse(char*, char*, int)': > x_yacc.c:1382: error: `x_lex' was not declared in this scope > make: *** [linux32/x_yacc.o] Error 1 Hi, You need to declare a matchin

Re: Using C++ generated parsers with autotools

2006-11-25 Thread David Fang
em in CLEANFILES += ... Alternatively, you can define: clean-local: rm ... and remove them manually there. HTH, David Fang Computer Systems Laboratory Electrical & Computer Engineering Cornell University http://www.csl.cornell.edu/~fang/ -- (2400 baud? Netscape 3.0

Re: Help, searching for a yacc group, is there one?

2006-09-26 Thread David Fang
> > I know this is the help-bison group, but I can't find a yacc group > > for my problem, and I want to do the basics in yacc, before I move on > > to learning bison (mainly for the C++ support). > > Why'd you want to learn writing parsers with yacc? bison basically implements > everything that ya

Re: Is there way to complete my Calculator with Bison or other GNU tools?

2006-07-03 Thread David Fang
> I want to encapsulate a C++ class ,which can works like a calculator,its > structure seems like this: > Class Calc > { > //in yylex, result will be evaluated... > > }; > In an other word, Can yylex ,yyparse() be encapsulated in a C++ Class ? Hi, "Can...". Yes, but you will nee

RE: Conditional generation of Grammar rules

2006-05-02 Thread David Fang
> Thanks for the response. > But I'm not sure I understood what you have mentioned. > Could you please give an example or a bit more detail? Sure, (at the risk of being slightly off-topic)... > > nonterminal X: > > #ifdef FEATURE > > { rule 1 } > > #else > > { rule 1; rule 2 } > > #endif Place

Re: Conditional generation of Grammar rules

2006-05-02 Thread David Fang
> Is there a way to conditionally generate grammar rules? > For example, I need to do something like > > nonterminal X: > #ifdef FEATURE > { rule 1 } > #else > { rule 1; rule 2 } > #endif > > I know that ifdefs dont work with the grammar but is there anything > else that can be done? Or is it pos

Re: Cleaning up memory in bison ?

2006-04-21 Thread David Fang
elete-ing the appropriate union-member will also call its destructors, thereby taking care of recursive deallocation. (I would not want to write a free_me function for each union member type by hand in C.) I haven't included the crucial scripts in this post, but I hope I&#x