Skip to content

Support INLINE function modifier #44

@associate-1

Description

@associate-1

Description

The INLINE keyword modifier on function declarations is not recognized by the parser. This is a standard occam feature (not occam-pi).

Syntax

INT INLINE FUNCTION seconds (VAL INT s)
  INT ticks:
  VALOF
    ticks := s * 1000000
    RESULT ticks
:

The INLINE keyword appears between the return type and FUNCTION keyword, indicating the function should be inlined at call sites.

Affected files

  • kroc/modules/course/examples/bar.occ (3 occurrences: lines 29, 45, 61)

Current error

bar.occ:29: expected :, got FUNCTION

The parser sees INT as a type and then expects a : (variable declaration), but encounters INLINE FUNCTION which it doesn't understand.

Proposed approach

For transpilation purposes, INLINE is purely an optimization hint and can be ignored — the function should be parsed and generated exactly as if INLINE were absent. The parser just needs to skip the INLINE keyword when it appears before FUNCTION in a declaration context.

Related

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