Club d'investissement
Title: E-mail message content Bonjour, Il semble que vous ne fassiez pas encore partie de notre club. Voudriez vous en faire partie ? L'inscription est gratuite et vous pouvez en retirer des avantages financiers importants. pour visiter notre site : Clicquez ici avec nos remerciements pour votre attention Gonzague de Neufchatel Président de Clubdinvestissement hello, it seems that you are not in our club.Would you like to become member? The registration is free and you will get great financial advantages to join us. please visit us : Click here bests regards Gonzague de Neufchatel CEO of Clubdinvestissement ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
Re: %union errors that shouldn't be there
At 17:50 +0100 2005/03/26, Laurence Finston wrote: > With unions, one wants to avoid dynamic allocations. Each dynamic allocation takes several tens, sometimes, hundreds of cycles. If pointers are used, then memory needs to be allocated for the objects they point to, whether the pointers are in a `struct' or a `union'. It needn't be allocated dynamically in either case. I don't see any advantage to having multiple members of pointer types in a `union', e.g., I guess the cleanup is generally different. But use whatever you feel comfortable with. > Unions are faster than dynamic allocations, and in the past, it was important that they take little space. I have nothing against `unions'. I think if pointers are going to be used anyway, then a single `void*' could be used for all types, in which case there would be no need for a `union'. If class types are to be allowed, the constructors of objects of these types might be performing dynamic allocation, so it might not pay to take the trouble of avoiding it for the other types. I think it's an interesting problem. The idea with extended unions, avoiding pointers, would be to avoid having to do hand code special cleanup. -- Hans Aberg ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
Help with shift/reduce conflict
%token YYID %% expression : hier_id | method_call /* unary and secondary expression follows. */ ; method_call : expression '.' YYID '(' expression ')' ; hier_id : YYID | hier_id '.' YYID ; How to resolve the shift/reduce conflict? Please help. -Soumitra. __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
A simple example of using bison++ and flex++
Dear All, I noticed that there is an interest in having an example of using bison++ and flex++. I also noticed that there is no concrete example in the web (from my search). For this reason, this an example of how to use bison++ and flex++. I am using bison++ Version 1.21-8 and flex++ version 2.5.4. The files are: file name: parser.y %name Parser %define LSP_NEEDED %define MEMBERS \ virtual ~Parser() {} \ private: \ yyFlexLexer lexer; %define LEX_BODY {return lexer.yylex();} %define ERROR_BODY {cerr << "error encountered at line: "< %header{ #include #include #include using namespace std; %} %union { int i_type; } %token UNKNOWN %token NUMBER %type number %start number %% number : NUMBER{ $$ = atoi(lexer.YYText());std::cout << "Parser value "<<$$< ; %% file name: scanner.l %option c++ %option noyywrap %{ #include #include "parser.h" #include //YY_CalcParser_STYPE val; %} DIGIT [0-9] DIGIT1 [1-9] %% {DIGIT1}{DIGIT}* { std::cout <<"Lexer: "<< yytext <> { yyterminate(); } %% == file name: test.cpp #include "parser.h" #include using namespace std; int main(int argc, char ** argv) { Parser parser; parser.yyparse(); return 0; } == To generate cpp files use: 1. bison++ -d -hparser.h -o parser.cpp parser.y 2. flex++ -d -oscanner.cpp scanner.l To compile the files user: 1. g++ -c parser.cpp 2. g++ -c scanner.cpp 3. g++ -c test.cpp To link them all 1. g++ -o test test.o parser.o scanner.o To test your parser/lexer use 1. echo "12345" | ./test For more information about options and declarations in flex++ and bison++, the man of flex++ and bison++ is an excellent source for that. With best regards. Belaid Moa. ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
Re: Help with shift/reduce conflict
can you tell a bit more about what your grammar tries to achieve ? from your very brief description, it sounds like you can do this: 1+3.YYID(7) but what would this mean ? Henrik On Sunday 27 March 2005 21.37, Soumitra Kumar wrote: > %token YYID > %% > expression : hier_id > > | method_call > > /* unary and secondary expression follows. > */ > ; > method_call : expression '.' YYID '(' expression ')' > ; > hier_id : YYID > > | hier_id '.' YYID > > ; > > How to resolve the shift/reduce conflict? Please help. > > -Soumitra. > > > > __ > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site! > http://smallbusiness.yahoo.com/resources/ > > > ___ > Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
Re: Help with shift/reduce conflict
1+3.YYID(7) has no meaning. But following is a valid expression: (YYID + YYID).YYID().YYID () + YYID() + YYID.YYID() + YYID.YYID -Soumitra. --- Henrik Sorensen <[EMAIL PROTECTED]> wrote: > can you tell a bit more about what your grammar > tries to achieve ? > from your very brief description, it sounds like you > can do this: > 1+3.YYID(7) > but what would this mean ? > Henrik > > On Sunday 27 March 2005 21.37, Soumitra Kumar wrote: > > %token YYID > > %% > > expression : hier_id > > > > | method_call > > > > /* unary and secondary expression > follows. > > */ > > ; > > method_call : expression '.' YYID '(' expression > ')' > > ; > > hier_id : YYID > > > > | hier_id '.' YYID > > > > ; > > > > How to resolve the shift/reduce conflict? Please > help. > > > > -Soumitra. > > > > > > > > __ > > Do you Yahoo!? > > Yahoo! Small Business - Try our new resources > site! > > http://smallbusiness.yahoo.com/resources/ > > > > > > ___ > > Help-bison@gnu.org > http://lists.gnu.org/mailman/listinfo/help-bison > __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ ___ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison