Skip to content

Support multi-value CASE labels #61

@associate-1

Description

@associate-1

Difficulty: Easy — Extend case label parsing to accept comma-separated values; small AST and codegen changes.

Summary

Occam CASE statements can have multiple comma-separated values on a single label. Currently only single-value labels are parsed.

Occam syntax

CASE ch
  '*n', '*c'
    SKIP
  ELSE
    out ! ch

Proposed Go mapping

switch ch {
case '\n', '\r':
    // SKIP
default:
    out <- ch
}

Affected files

  • test_bell.occ (lines 39, 77)

Work required

  1. Parser: After parsing the first case value, check for comma and parse additional values
  2. AST: Change CaseOption.Value from single expression to a list
  3. Codegen: Emit comma-separated values in Go case clause

Part of #43.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions