Opened 14 years ago

Last modified 14 years ago

#1558 closed defect (wontfix)

Parse error: Modelica assignment statements

Reported by: Willi Braun Owned by: Willi Braun
Priority: high Milestone:
Component: Parser Version: trunk
Keywords: Cc: Willi Braun,

Description

Following model:

class test
  Real a(start = 1.0);
algorithm
  der(a) := a;
end A;

produce

Error: Parse error: Modelica assignment statements are either on the form 'component_reference := expression' or '( output_expression_list ) := function_call'

But it's legal Modelica.

Change History (4)

comment:1 by Adrian Pop, 14 years ago

This is not valid Modelica. Dymola supports it but the grammar does not allow it.
You can have function calls on the left hand side only in equation sections.
In the algorithm sections you can only have function calls on the right hand side.

comment:2 by Willi Braun, 14 years ago

ah. ok thanks.

comment:3 by Adrian Pop, 14 years ago

We can fix it fine, that's no issue, but i don't think we should.
I mean you could rewrite it to a := der(a); which is correct and
should work fine (i hope :) ).

comment:4 by Willi Braun, 14 years ago

No, I don't think we should fix it. I just misinterpret der(a) as a variable name for $DERa, but it is more. At least it will make no sense when you consider something like this: der(a*b) := c this will expand to der(a)*b + der(b)*a and then it's an issue.

Note: See TracTickets for help on using tickets.