|
Boost Users : |
From: Jörg Becker (news_at_[hidden])
Date: 2007-05-04 09:34:06
Hi there,
I have a problem compiling the following parser with gcc-3.3 in a 64 bit
environment: the compiler consumes a lot of cpu time, but never returns.
On my old 32 bit box I could compile a similar parser without problems. Also I
can compile this parser with gcc-3.3 -m32. With gcc-4.1 I can build a 64 bit
version but due to company restrictions I have to use the gcc-3.3.
Thanks for any suggestions.
Jörg
-----------------------
parser definition
my_parser.h
-----------------------
#ifndef my_parser_h
#define my_parser_h
#include <boost/spirit/core.hpp>
#include <boost/spirit/attribute.hpp> // closure
struct my_closure : boost::spirit::closure< my_closure, bool > {
member1 match;
};
struct my_parser : public boost::spirit::grammar < my_parser,
my_closure::context_t > {
my_parser () {}
template <typename ScannerT>
struct definition {
definition ( my_parser const& self ) {
top = boost::spirit::str_p( "a" )[ self.match = phoenix::arg1 ];
}
typedef boost::spirit::rule< ScannerT, my_closure::context_t > rule_t;
boost::spirit::rule< ScannerT > top;
boost::spirit::rule< ScannerT > const&
start () const {
return top;
}
};
};
#endif // my_parser_h
------------------
test program
------------------
#include "my_parser.h"
int main () {
my_parser parser;
bool match = false;
boost::spirit::parse_info<> info =
parse( "a and b or c",
parser[ phoenix::var( match ) = phoenix::arg1 ],
boost::spirit::space_p );
if ( info.full ) {
return match;
} else {
return -1;
}
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net