Skip to content

Add PRI ALT and PRI PAR support#83

Merged
associate-1 merged 1 commit intomainfrom
feature/pri-alt-par-76
Feb 23, 2026
Merged

Add PRI ALT and PRI PAR support#83
associate-1 merged 1 commit intomainfrom
feature/pri-alt-par-76

Conversation

@associate-1
Copy link
Member

@associate-1 associate-1 commented Feb 23, 2026

Summary

  • Adds PRI as a lexer keyword and parses PRI ALT / PRI PAR constructs
  • Both map to the same Go output as their non-priority counterparts (select and goroutines + sync.WaitGroup)
  • AST nodes record a Priority bool field for potential future use
  • Updates docs (CLAUDE.md, TODO.md) to reflect the new support

Important caveat: This implementation does not provide true priority semantics. Go's select chooses uniformly at random among ready cases, and goroutines have no scheduling priority. Programs that depend on priority ordering for correctness will not behave the same as on a real occam/transputer runtime. See #84 for tracking true priority semantics.

Closes #76

Test plan

  • TestPriAltBlock — parser correctly produces AltBlock with Priority == true
  • TestPriParBlock — parser correctly produces ParBlock with Priority == true
  • TestE2E_PriAlt — transpile + compile + run PRI ALT program, verify output
  • TestE2E_PriPar — transpile + compile + run PRI PAR program, verify output
  • All existing tests pass (go test ./lexer ./parser ./codegen)

🤖 Generated with Claude Code

Add PRI as a keyword and parse PRI ALT / PRI PAR constructs. Both are
treated identically to their non-priority counterparts since Go's select
and goroutines have no priority semantics. The AST records the Priority
flag for potential future use.

Note: This implementation accepts and correctly transpiles PRI ALT and
PRI PAR, but does not provide true priority semantics. Go's select
statement chooses uniformly at random among ready cases, and goroutines
have no scheduling priority. Programs that depend on priority ordering
for correctness will not behave as expected.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@associate-1 associate-1 merged commit 2bd8573 into main Feb 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PRI ALT (priority alternation)

2 participants