Spirit is a PEG parser:
- Parsing expression grammar (wikipedia)
- See also the About Page introduction on the http://boost-spirit.com site
- Parser Expression Grammar in the documentation abstracts
Relevant quote:
Syntactically, PEGs also look similar to context-free grammars (CFGs), but they have a different interpretation: the choice operator selects the first match in PEG, while it is ambiguous in CFG
So, no, the second example is not ambiguous at all, it just results in infinite recursion (--> stackoverflow).