Boost logo

Boost :

Subject: Re: [boost] [spirit] scan_keyword: scan an InputIterator for a keyword.
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-11-29 17:23:35


Le 29/11/11 00:47, Joel de Guzman a écrit :
> On 11/29/2011 5:45 AM, Vicente J. Botet Escriba wrote:
>> Hi,
>>
>> for chrono input I'm using a scan_keyword function that adapted from libc++ library (you
>> can find the code in[1]).
>> Next follows the interface:
>>
> [snip]
>> What is the better way to do that (or something similar) with Spirit/Lexer?
>> Can we hope that the Spirit solution could perform much better?
>> What about if the strings to parse are know at compile-time?
>>
>> [1] https://svn.boost.org/svn/boost/trunk/boost/chrono/detail/scan_keyword.hpp
> The symbol parser seems to be your friend here. http://tinyurl.com/7vue9nu
> The search is O(log n+k) using a TST.
Hi,

thanks for the pointer. This seems quite simple, I will try it and
compare the performances.
Does the parser try to scan the largest symbol?
Shouldn't Lexer be more adequate/efficient to this use case?
Sorry, what is a TST?
> Spirit parses at runtime, not compile time. I've seen a compile time
> parser for compile-time strings posted somewhere in this list, but
> I don't recall exactly.
Thanks anyway,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk