Skip to content

Property value parser: arithmetic expressions not accepted (e.g., 5 * 1000 ps) #127

@avrabe

Description

@avrabe

Summary

Property value parser accepts only literals; arithmetic expressions fail. Workaround is to pre-compute the literal, which obscures intent.

Reproducer

package Test_Expr
public
  processor P
    properties
      Clock_Period => 5 * 1000 ps;
  end P;
end Test_Expr;
$ spar parse /tmp/test_expr.aadl
/tmp/test_expr.aadl:78: expected SEMICOLON
/tmp/test_expr.aadl:78: expected END_KW
...

Workaround

Clock_Period => 5000 ps; — numerically identical but loses the 5 MHz × 1ms = 5000 cycles-style expressiveness.

AADL reference

AS5506B §11.2.5 — property values permit numeric_term which includes signed_aadl_integer * identifier for units, and property values can include expressions in the constant definitions.

Real-world impact

In wohl_hardware.aadl I wrote Active_Current_uA => 6.0 * 1000.0; (6 mA expressed as µA), had to pre-compute to 6000.0. When a reader later wants to change "6 mA" to "8 mA" they now edit the literal 8000.0 without context about what unit it was.

Side note

Same wrong line-number pattern as the other parser-error reports — 78 on a 7-line file.

🤖 Generated with Claude Code

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