This document tracks the implementation status of C# language features in the BSharp parser.
Legend:
- ✅ Fully Supported - Feature is completely implemented and tested
- 🟡 Partial Support - Feature is partially implemented or has known limitations
- ⚠️ Planned - Feature is planned but not yet implemented
- ❌ Not Supported - Feature is not currently supported
| Feature | Status | Notes |
| Classes | ✅ | Full support including nested classes |
| Structs | ✅ | Full support |
| Interfaces | ✅ | Full support |
| Enums | ✅ | Full support including flags |
| Delegates | ✅ | Full support |
| Feature | Status | Notes |
| Fields | ✅ | Public, private, protected, internal |
| Properties | ✅ | Get/set accessors |
| Methods | ✅ | Instance and static methods |
| Constructors | ✅ | Instance and static constructors |
| Destructors/Finalizers | ✅ | Full support |
| Events | ✅ | Full support |
| Indexers | ✅ | Full support |
| Operators | ✅ | Operator overloading |
| Feature | Status | Notes |
if/else | ✅ | Full support |
switch/case | ✅ | Traditional switch statements |
for | ✅ | Full support |
foreach | ✅ | Full support |
while | ✅ | Full support |
do-while | ✅ | Full support |
break | ✅ | Full support |
continue | ✅ | Full support |
return | ✅ | Full support |
throw | ✅ | Full support |
try/catch/finally | ✅ | Full exception handling |
using statement | ✅ | Resource management |
lock | ✅ | Thread synchronization |
goto | ✅ | Including goto case |
checked/unchecked | ✅ | Overflow checking |
| Feature | Status | Notes |
| Literals | ✅ | All literal types |
| Arithmetic operators | ✅ | +, -, *, /, % |
| Comparison operators | ✅ | ==, !=, <, >, <=, >= |
| Logical operators | ✅ | &&, ` |
| Bitwise operators | ✅ | &, ` |
| Assignment operators | ✅ | =, +=, -=, etc. |
| Conditional operator | ✅ | ? : ternary |
| Member access | ✅ | . operator |
| Indexing | ✅ | [] operator |
| Method invocation | ✅ | Full support |
| Object creation | ✅ | new expressions |
| Array creation | ✅ | Single and multi-dimensional |
| Type casting | ✅ | (Type)expr |
typeof | ✅ | Type information |
sizeof | ✅ | Size of types |
is operator | ✅ | Type testing |
as operator | ✅ | Safe casting |
| Feature | Status | Notes |
| Primitive types | ✅ | All built-in types |
| Arrays | ✅ | Single, multi-dimensional, jagged |
| Nullable value types | ✅ | T? syntax |
| Reference types | ✅ | Classes, interfaces, delegates |
| Value types | ✅ | Structs, enums |
| Feature | Status | Notes |
| Access modifiers | ✅ | public, private, protected, internal |
static | ✅ | Full support |
readonly | ✅ | Full support |
const | ✅ | Full support |
virtual | ✅ | Full support |
override | ✅ | Full support |
abstract | ✅ | Full support |
sealed | ✅ | Full support |
extern | ✅ | Full support |
| Feature | Status | Notes |
| Generics | ✅ | Full support including constraints |
| Generic constraints | ✅ | where T : class, struct, new(), etc. |
| Partial types | ✅ | partial keyword |
| Anonymous methods | ✅ | delegate { } syntax |
| Nullable types | ✅ | Nullable<T> and T? |
| Iterators | ✅ | yield return, yield break |
| Covariance/Contravariance | ✅ | in/out variance |
| Static classes | ✅ | Full support |
| Property accessors | ✅ | Different accessibility |
| Namespace aliases | ✅ | using Alias = Namespace |
?? operator | ✅ | Null-coalescing |
| Feature | Status | Notes |
| Auto-implemented properties | ✅ | { get; set; } |
| Object initializers | ✅ | new T { Prop = value } |
| Collection initializers | ✅ | new List<T> { 1, 2, 3 } |
| Anonymous types | ✅ | new { Name = "x" } |
| Extension methods | ✅ | this parameter |
| Lambda expressions | ✅ | x => x * 2 |
| Expression trees | ✅ | Parsing support |
| LINQ query syntax | ✅ | from x in y select z |
| Implicitly typed variables | ✅ | var keyword |
| Partial methods | ✅ | In partial classes |
| Feature | Status | Notes |
| Dynamic binding | ✅ | dynamic type |
| Named arguments | ✅ | Method(param: value) |
| Optional parameters | ✅ | Default parameter values |
| Generic covariance/contravariance | ✅ | Enhanced support |
| Embedded interop types | ✅ | no-pia |
| Feature | Status | Notes |
| Async/await | ✅ | async and await keywords |
| Caller info attributes | ✅ | [CallerMemberName], etc. |
| Feature | Status | Notes |
| Auto-property initializers | ✅ | public int X { get; set; } = 1; |
| Expression-bodied members | ✅ | => expr for methods/properties |
using static | ✅ | Import static members |
| Null-conditional operator | ✅ | ?. and ?[] |
| String interpolation | ✅ | $"Hello {name}" |
nameof operator | ✅ | nameof(variable) |
| Index initializers | ✅ | [index] = value |
| Exception filters | ✅ | catch (E) when (condition) |
await in catch/finally | ✅ | Full support |
| Feature | Status | Notes |
| Out variables | ✅ | Method(out var x) |
| Tuples | ✅ | (int, string) syntax |
| Tuple deconstruction | ✅ | (var x, var y) = tuple |
| Pattern matching | ✅ | is patterns |
| Local functions | ✅ | Functions inside methods |
| Ref returns and locals | ✅ | ref keyword |
| Discards | ✅ | _ placeholder |
| Binary literals | ✅ | 0b1010 |
| Digit separators | ✅ | 1_000_000 |
| Throw expressions | ✅ | x ?? throw new E() |
| Expression-bodied constructors | ✅ | => expr syntax |
| Expression-bodied finalizers | ✅ | => expr syntax |
| Expression-bodied accessors | ✅ | get => expr |
| Feature | Status | Notes |
| Async main | ✅ | async Task Main() |
| Default literal expressions | ✅ | default without type |
| Inferred tuple names | ✅ | Automatic naming |
| Pattern matching on generics | ✅ | Full support |
| Feature | Status | Notes |
ref readonly | ✅ | Read-only references |
in parameters | ✅ | Pass by readonly reference |
ref struct | ✅ | Stack-only structs |
| Non-trailing named arguments | ✅ | Mixed named/positional |
private protected | ✅ | Access modifier |
| Leading underscores in numeric literals | ✅ | _123 |
Conditional ref expressions | ✅ | ref in ternary |
| Feature | Status | Notes |
| Tuple equality | ✅ | == and != |
| Attributes on backing fields | ✅ | [field: Attribute] |
| Expression variables in initializers | ✅ | Full support |
ref local reassignment | ✅ | Reassign ref locals |
| Stackalloc initializers | ✅ | stackalloc[] { 1, 2 } |
Pattern-based fixed | ✅ | Custom fixed |
| Improved overload candidates | ✅ | Better resolution |
| Feature | Status | Notes |
| Nullable reference types | ✅ | string? annotations |
| Default interface methods | ✅ | Interface implementations |
| Pattern matching enhancements | ✅ | Switch expressions, property patterns |
| Switch expressions | ✅ | x switch { ... } |
| Property patterns | ✅ | { Prop: value } |
| Tuple patterns | ✅ | (1, 2) patterns |
| Positional patterns | ✅ | Deconstruction patterns |
| Using declarations | ✅ | using var x = ... |
| Static local functions | ✅ | static modifier |
| Disposable ref structs | ✅ | IDisposable on ref struct |
| Nullable reference types | ✅ | #nullable directives |
| Asynchronous streams | ✅ | IAsyncEnumerable<T> |
| Asynchronous disposable | ✅ | IAsyncDisposable |
| Indices and ranges | ✅ | ^ and .. operators |
| Null-coalescing assignment | ✅ | ??= operator |
| Unmanaged constructed types | ✅ | Generic constraints |
| Stackalloc in nested expressions | ✅ | Full support |
| Feature | Status | Notes |
| Records | ✅ | record keyword |
| Init-only setters | ✅ | init accessor |
| Top-level statements | ✅ | No Main method required |
| Pattern matching improvements | ✅ | Relational, logical patterns |
| Relational patterns | ✅ | > 0, <= 10 |
| Logical patterns | ✅ | and, or, not |
Target-typed new | ✅ | new() without type |
| Covariant returns | ✅ | Override with derived type |
Extension GetEnumerator | ✅ | foreach support |
| Lambda discard parameters | ✅ | (_, _) => expr |
| Attributes on local functions | ✅ | Full support |
| Module initializers | ✅ | [ModuleInitializer] |
| Partial methods with return | ✅ | Extended partial |
| Native integers | ✅ | nint, nuint |
| Function pointers | ✅ | delegate* syntax |
| Suppress emitting localsinit | ✅ | [SkipLocalsInit] |
| Target-typed conditional | ✅ | ? : inference |
| Feature | Status | Notes |
| Record structs | ✅ | record struct |
| Global using directives | ✅ | global using |
| File-scoped namespaces | ✅ | namespace X; |
| Extended property patterns | ✅ | Nested patterns |
| Constant interpolated strings | ✅ | const strings |
| Lambda improvements | ✅ | Natural types, attributes |
| Caller expression attribute | ✅ | [CallerArgumentExpression] |
| Improved definite assignment | ✅ | Better analysis |
Allow AsyncMethodBuilder | ✅ | Custom builders |
Record types with sealed ToString | ✅ | Sealed override |
| Assignment and declaration in same deconstruction | ✅ | Mixed syntax |
| Allow both assignment and declaration | ✅ | Full support |
| Feature | Status | Notes |
| Raw string literals | ✅ | """text""" |
| Generic attributes | ✅ | [Attr<T>] |
| UTF-8 string literals | ✅ | "text"u8 |
| Newlines in string interpolations | ✅ | Multi-line expressions |
| List patterns | ✅ | [1, 2, .., 10] |
| File-local types | ✅ | file class |
| Required members | ✅ | required modifier |
| Auto-default structs | ✅ | Default initialization |
Pattern match Span<char> | ✅ | Constant patterns |
Extended nameof scope | ✅ | More contexts |
| Numeric IntPtr | ✅ | Operators on IntPtr |
ref fields | ✅ | In ref structs |
scoped ref | ✅ | Lifetime annotations |
| Checked operators | ✅ | User-defined checked |
| Feature | Status | Notes |
| Primary constructors | ✅ | Full support for classes and structs |
| Collection expressions | ✅ | [1, 2, 3] and spread .. syntax |
| Inline arrays | ❌ | Not yet implemented |
| Optional parameters in lambdas | ✅ | Full support |
ref readonly parameters | ✅ | Full support |
| Alias any type | ✅ | using Alias = (int, string) |
| Experimental attribute | ✅ | [Experimental] |
| Interceptors | ❌ | Not yet implemented |
| Feature | Status | Notes |
params collections | ⚠️ | Planned |
| New lock type | ⚠️ | Planned |
New escape sequence \e | ⚠️ | Planned |
| Method group natural type | ⚠️ | Planned |
| Implicit indexer access | ⚠️ | Planned |
ref and unsafe in iterators | ⚠️ | Planned |
ref struct interfaces | ⚠️ | Planned |
Allows ref struct types | ⚠️ | Planned |
| Feature | Status | Notes |
| Extension members | 🟡 | Parser + emitter for extension blocks; semantics planned |
field keyword | ⚠️ | Planned - Field-backed properties |
| Null-conditional assignment | ⚠️ | Planned - ?. on left side of = |
nameof unbound generics | ⚠️ | Planned - nameof(List<>) |
Implicit Span<T> conversions | ⚠️ | Planned - First-class span support |
| Lambda parameter modifiers | ⚠️ | Planned - (out x) => ... without types |
| Partial constructors | ⚠️ | Planned - partial instance constructors |
| Partial events | ⚠️ | Planned - partial events |
| User-defined compound assignment | ⚠️ | Planned - Custom +=, -= operators |
| Feature | Status | Notes |
#if / #elif / #else / #endif | ✅ | Conditional compilation |
#define / #undef | ✅ | Symbol definition |
#warning / #error | ✅ | Compiler messages |
#line | ✅ | Line number control |
#region / #endregion | ✅ | Code folding |
#pragma warning | ✅ | Warning control |
#pragma checksum | ✅ | Debugging support |
#nullable | ✅ | Nullable context |
| Feature | Status | Notes |
| XML documentation | ✅ | /// and /** */ |
<summary> | ✅ | Full support |
<param> | ✅ | Full support |
<returns> | ✅ | Full support |
<exception> | ✅ | Full support |
<see> / <seealso> | ✅ | Full support |
<example> | ✅ | Full support |
<code> / <c> | ✅ | Full support |
<para> | ✅ | Full support |
<list> | ✅ | Full support |
<include> | ✅ | Full support |
| Feature | Status | Notes |
| Pointers | ✅ | T* syntax |
unsafe keyword | ✅ | Blocks and methods |
fixed statement | ✅ | Pin managed objects |
stackalloc | ✅ | Stack allocation |
| Function pointers | ✅ | delegate* (C# 9+) |
sizeof operator | ✅ | Type sizes |
| Pointer arithmetic | ✅ | Full support |
| Address-of operator | ✅ | & operator |
| Indirection operator | ✅ | * operator |
| Version | Features | Supported | Partial | Planned | Not Supported | Completion |
| C# 1.0 | 80+ | 80+ | 0 | 0 | 0 | 100% |
| C# 2.0 | 11 | 11 | 0 | 0 | 0 | 100% |
| C# 3.0 | 10 | 10 | 0 | 0 | 0 | 100% |
| C# 4.0 | 5 | 5 | 0 | 0 | 0 | 100% |
| C# 5.0 | 2 | 2 | 0 | 0 | 0 | 100% |
| C# 6.0 | 10 | 10 | 0 | 0 | 0 | 100% |
| C# 7.0 | 13 | 13 | 0 | 0 | 0 | 100% |
| C# 7.1 | 4 | 4 | 0 | 0 | 0 | 100% |
| C# 7.2 | 7 | 7 | 0 | 0 | 0 | 100% |
| C# 7.3 | 7 | 7 | 0 | 0 | 0 | 100% |
| C# 8.0 | 18 | 18 | 0 | 0 | 0 | 100% |
| C# 9.0 | 17 | 17 | 0 | 0 | 0 | 100% |
| C# 10.0 | 12 | 12 | 0 | 0 | 0 | 100% |
| C# 11.0 | 13 | 13 | 0 | 0 | 0 | 100% |
| C# 12.0 | 7 | 6 | 0 | 0 | 1 | ~86% |
| C# 13.0 | 8 | 0 | 0 | 8 | 0 | 0% (Preview) |
| C# 14.0 | 9 | 0 | 0 | 9 | 0 | 0% (Preview) |
All parser tests are located in tests/parser/ with comprehensive coverage:
- Expression tests:
tests/parser/expressions/
- Statement tests:
tests/parser/statements/
- Declaration tests:
tests/parser/declarations/
- Type tests:
tests/parser/types/
- Pattern matching tests:
tests/parser/expressions/pattern_matching_tests.rs
- Preprocessor tests:
tests/parser/preprocessor/
Real-world C# projects in tests/fixtures/:
- happy_path/: Valid, well-formed C# code
- complex/: Complex real-world scenarios
-
Inline Arrays: Not yet implemented
- Requires
[InlineArray(n)] attribute support
- Planned for future release
-
Interceptors: Not yet implemented
- Experimental feature in C# 12
- May be implemented when feature stabilizes
All C# 13.0 and 14.0 features are in preview/development status and planned for future implementation as they stabilize in the official .NET releases.
To add support for new C# features:
- Update AST nodes in
src/syntax/nodes/
- Implement parser in
src/parser/
- Add comprehensive tests in
tests/parser/
- Update this matrix to reflect new support
- Document in relevant parser documentation
See Contributing Guide for details.
- C# Language Specification: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/
- C# Version History: https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/
- Roslyn Source: https://github.com/dotnet/roslyn
- Parser Implementation:
src/parser/
- Test Suite:
tests/parser/
Last Updated: 2025-09-30
Parser Version: Current development version
Maintained By: BSharp Project Contributors