Re: Spirit-X3 | Boost 1.59 | Compilation never finishes for a recursive grammar
Larry Evans <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 04/21/2017 01:44 AM, Arun Muralidharan wrote: > Hello Folks, > I have posted the question in SO as well ( > http://stackoverflow.com/questions/43526708/optimizing-the-grammar ), but I > believe I have better chance of getting an answer to my query here. > > <Reposting the question here> > > I am working on creating an xpath2.0 parser as per the RFC. It's basically a > subproject of another project that I am working on. > > After some initial success, I did the mistake of writing a bunch of grammar > rules and AST instead of compiling and testing it at every point. After that > I basically had a novel of template error messages to read (my fault > actually). > > I have then then tried to work my way up by trying to compile and test bits > and pieces of the grammar rules individually and now I am stuck with the > compilation process never ending. > > I am attaching two files along with this post: > 1. All the code in a single cpp file. > 2. Broken up the code in multiple files as suggested before in the mailing > list. (as per calc9 example) > > Compiler - clang 3.8 on Mac (i7 processor 8 GB RAM) > template-depth - 1024 > Boost Version - 1.59 > > rec_ex_orig.cc > <http://boost.2283326.n4.nabble.com/file/n4693813/rec_ex_orig.cc> > > rec_ex.tar <http://boost.2283326.n4.nabble.com/file/n4693813/rec_ex.tar> > I suspect the problem is here: https://github.com/cppljevans/spirit/blob/get_rhs/include/boost/spirit/home/x3/nonterminal/detail/rule.hpp#L215 When this code was compiled without -DBOOST_SPIRIT_GET_RHS_CRTP=1 it took several minutes, consuming 100% of CPU1, and steadily increased memory consumption. However, with -DBOOST_SPIRIT_GET_RHS_CRTP=1, it compile in a flash, as shown by the attached. HTH. -regards, Larry ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Spirit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spirit-general
rec_ex_orig.compilation
(text/plain, 1.7 KB)
-*- mode: compilation; default-directory: "~/prog_dev/boost/releases/ro/boost_1_63_0/sandbox/pull_requests/context_debug_fix.fork/spirit/workbench/x3/rec_ex_orig/" -*-
Compilation started at Fri Apr 21 12:24:34
make compile
/home/evansl/dwnlds/llvm/3.9/prebuilt/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang++ -c -O0 -stdlib=libc++ -std=c++1z -ftemplate-backtrace-limit=0 -fdiagnostics-show-template-tree -fno-elide-type -fmacro-backtrace-limit=0 -c -std=c++14 -ftemplate-depth=1024 -DBOOST_SPIRIT_GET_RHS_CRTP=1 -I/home/evansl/prog_dev/boost/releases/ro/boost_1_63_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include -I/home/evansl/prog_dev/boost/releases/ro/boost_1_63_0 rec_ex_orig.cpp
In file included from rec_ex_orig.cpp:10:
In file included from /home/evansl/prog_dev/boost/releases/ro/boost_1_63_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3.hpp:17:
In file included from /home/evansl/prog_dev/boost/releases/ro/boost_1_63_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3/nonterminal.hpp:10:
/home/evansl/prog_dev/boost/releases/ro/boost_1_63_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3/nonterminal/rule.hpp:23:11: warning:
not(BOOST_SPIRIT_ATTR_XFORM_IN_RULE) [-W#pragma-messages]
#pragma message "not(BOOST_SPIRIT_ATTR_XFORM_IN_RULE)"
^
/home/evansl/prog_dev/boost/releases/ro/boost_1_63_0/sandbox/pull_requests/context_debug_fix.fork/spirit/include/boost/spirit/home/x3/nonterminal/rule.hpp:26:11: warning:
yes(BOOST_SPIRIT_GET_RHS_CRTP) [-W#pragma-messages]
#pragma message "yes(BOOST_SPIRIT_GET_RHS_CRTP)"
^
2 warnings generated.
Compilation finished at Fri Apr 21 12:24:39