Skip to content

Support KRoC mobile/shared channel extensions #40

@associate-1

Description

@associate-1

Summary

Several advanced KRoC (Kent Retargetable occam Compiler) extensions are not yet supported. These are needed by programs like the mandelbrot demo (kroc/demos/ttygames/mandelbrot.occ, see #39) and likely other KRoC programs that use mobile data, typed channels, and shared-resource synchronization.

Unsupported Constructs

1. DATA TYPE — Named record type alias

DATA TYPE COMPLEX64
  RECORD
    REAL64 real, imag:
:

2. CHAN TYPE — Channel type definitions with mobile record payloads

CHAN TYPE CT.WORK.IN
  MOBILE RECORD
    CHAN INT notify?:
    CHAN P.JOB.IN in!:
:

3. INLINE FUNCTION — Inline modifier on function declarations

REAL64 INLINE FUNCTION COMPLEX64ABSSQ (VAL COMPLEX64 x) IS
  (x[real]*x[real]) + (x[imag]*x[imag]):

4. SHARED parameter qualifier — Shared channel ownership

PROC worker (SHARED CT.WORK.IN! link.in, SHARED CT.WORK.OUT! link.out)

5. MOBILE constructor — Creating mobile channel type instances

mwsvr.in, mwcli.in := MOBILE CT.WORK.IN

6. CLAIM block — Mutual exclusion for shared channel access

CLAIM link.in
  link.in[in] ? frame; jobid; job

Notes

These are all KRoC-specific extensions beyond base occam for mobile data, typed channels, and shared-resource synchronization. Each would require new lexer tokens, AST nodes, parser rules, and codegen support.

Suggested implementation priority (simplest first):

  1. INLINE FUNCTION — Modify FuncDecl parsing to accept and ignore the INLINE keyword
  2. DATA TYPE — New TypeAlias AST node and record body parsing
  3. SHARED qualifier — Add to parameter parsing for channels
  4. CLAIM block — New statement type for synchronization (could map to sync.Mutex)
  5. CHAN TYPE / MOBILE — Most complex; requires new type definitions and constructor expressions

Related: #39

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