040 literate annotations

○ Planned This feature is planned but not yet implemented.

Feature: Literate annotations - markdown prose + directives in annotation blocks

Failure Output

error[PARSE003]: invalid line in vertical annotation block - expected '-' bullet or ']'
  --> tests/regression/300_ADVANCED_FEATURES/310_COMPTIME/310_040_literate_annotations/input.kz:12:1
    |
 12 | # Token Grammar
    | ^

Code

// TEST: Literate Annotations
// STATUS: ASPIRATIONAL
//
// Annotation blocks as micro-documents: markdown prose + directives.
// Parser extracts `-` prefixed lines as directives, ignores prose.
//
// This brings literate programming to metadata - the annotation
// explains AND instructs in one place.

~[
# Token Grammar

Defines a lexer for simple arithmetic expressions. Each branch
represents a token type with its regex pattern embedded in the
phantom type annotation.

- derive(parser)

## Generated Events

The parser transform will generate:
- `token.parse` - stream -> token branch
- `token.serialize` - token -> bytes

## Performance

- optimize(level: 3)
- inline

## Whitespace

We skip whitespace tokens rather than emitting them.
This keeps the token stream clean for the parser.

- whitespace(skip)
] event token {}
| number u64[\d+]
| string []const u8["[^"]*"]
| identifier []const u8[[a-zA-Z_][a-zA-Z0-9_]*]
| lparen void[(]
| rparen void[)]
| plus void[+]
| star void[*]
| whitespace void[\s+]

pub fn main() void {}
input.kz