This project is read-only.

Why are grammar productions left-recursive?

Topics: C# Language Design
May 20, 2014 at 2:10 PM
In the C# Language Specification, why are grammar productions defined using left-recursion?

For example in section 2.3, consider the following production.

input-elements   input-element
May 20, 2014 at 9:45 PM
Because it is much easier to parse that way using LL or recursive-descent parsing. Roslyn's parsers are handwritten to be recursive-descent, and because the grammar is left-recursive, it is very easy to translate the productions (by hand) directly into parse methods.
Marked as answer by scottfleischmanfl on 5/21/2014 at 10:27 AM