From: Juan Carlos Arevalo-Baeza (jcab.lists_at_[hidden])
Date: 2002-10-11 22:34:51
On Fri, 11 Oct 2002 18:33:47 -0500, Dan Gohman wrote:
>Instances of rule have hard-coded scanner types. This is inconvenient,
>and the documentation suggests that this is unavoidable.
Correct. Scanners don't use run-time polymorphism because of performance, and because they need to be parameterized by the iterator type used underneath and, ultimately, the type of the characters in the input. Spirit not only supports characters and wide chars, but any arbitrary type as input. For example, I'm currently experimenting with a lexer (written with Spirit) and separate parser (also done with Spirit) that works on the token stream output from the lexer. You can check out this code, if you so wish, here:
The files involved are all except for cpp_grammar, which is just an older experimental C++ grammar, which I derived from the C grammar that comes with Spirit.
>however, it seems that rule doesn't really need to know exactly which
>scanner it will be used with, but instead only certain traits of that
Which traits do you mean?
>If there's some reason why rule really has to have a scanner
>template parameter that the authors already know about, it would make
>a great entry for the rationale page. Otherwise, I'd like to look into
>making rule more flexible.
I know the feeling. Several people (including me) have gone through the same process. It's... instructive. :)
ICQ: 10913692 @WORK: 101728263
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk