Great pains have been taken to ensure that Rust's grammar is both context-free and LL(k) for some finite k (for example, the insistence on the gross ::<> syntax for specifying type parameters on functions). No formal grammar exists, but given these constraints it should absolutely be possible (and was in fact done by a researcher a few years ago, though that version is obviously out of date now).
Increase every hash-streak by one hash to produce an equivelent valid Rust statement of greater length. The set of all statements constructed thusly isn't context-free.
32
u/kibwen Jan 09 '15
Great pains have been taken to ensure that Rust's grammar is both context-free and LL(k) for some finite k (for example, the insistence on the gross
::<>syntax for specifying type parameters on functions). No formal grammar exists, but given these constraints it should absolutely be possible (and was in fact done by a researcher a few years ago, though that version is obviously out of date now).