Implement the following plan:
Plan: Support dotted protocol tags (Issue #68)
Context
Occam variant protocol tags can contain dots (e.g., bar.data, bar.terminate, bar.blank), as seen in real-world code like kroc/modules/course/examples/bar.occ. The issue requests support for this.
After investigation, the lexer already handles dots as part of identifiers (lexer.go:280 — readIdentifier() loops while isLetter || isDigit || ch == '.'), so bar.data is already a single IDENT token. The codegen already calls goIdent() on tag names, converting dots to underscores. The core functionality likely already works, but has no test coverage.
Changes
1. Add parser unit test for dotted variant protocol tags
File: parser/parser_test.go
Add TestVariantProtocolDeclDottedTags — a protocol with dotted tag names (bar.data ; INT, bar.terminate, bar.blank ; INT). Verify each ProtocolVariant.Tag preserves the dotted name (e.g., "bar.data").
2. Add codegen unit test for dotted variant protocol types
File: codegen/codegen_test.go
Add TestVariantProtocolDottedTags — verify generated Go output contains underscore-converted names:
- type _proto_BAR_PROTO_bar_data struct { ... }
- type _proto_BAR_PROTO_bar_terminate struct{}
- etc.
3. Add e2e test for dotted protocol tags (send + receive)
File: codegen/e2e_protocol_test.go
Add TestE2E_VariantProtocolDottedTags — a full transpile→compile→run test:
- Protocol with dotted tags (with and without payloads)
- Variant send with dotted tag + payload (c ! bar.data ; 42)
- Variant send with dotted tag + no payload (c ! bar.blank)
- Variant receive with dotted tags in CASE arms
- Verify expected output
4. Fix any issues found during testing
If the tests reveal bugs, fix them in the relevant parser/codegen code.
5. Update TODO.md
Document that dotted protocol tags are now supported.
Verification
go test ./parser -run TestVariantProtocolDeclDottedTags -v
go test ./codegen -run TestVariantProtocolDottedTags -v
go test ./codegen -run TestE2E_VariantProtocolDottedTags -v
go test ./... # full suite to check for regressions
If you need specific details from before exiting plan mode (like exact code snippets, error messages, or content you generated), read the full transcript at: /home/david/.claude/projects/-home-david-projects-code-associates-occam2go/e4fce02a-e445-42c2-8859-d822a1765d80.jsonl