Skip to content

Derivative in left-hand-side#3838

Open
HansOlsson wants to merge 3 commits intomodelica:masterfrom
HansOlsson:DerLhs
Open

Derivative in left-hand-side#3838
HansOlsson wants to merge 3 commits intomodelica:masterfrom
HansOlsson:DerLhs

Conversation

@HansOlsson
Copy link
Collaborator

As previously discussed.
Closes #3764

@HansOlsson HansOlsson added this to the 2026-March milestone Mar 4, 2026
Comment on lines 92 to 95
( component-reference ( ":=" expression | function-call-args )
| der "(" component-reference ")" ":=" expression
| "(" output-expression-list ")" ":="
component-reference function-call-args
Copy link
Collaborator

@henrikt-ma henrikt-ma Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align with how it is written in the grammar, or take the opportunity to replace outdated duplicated grammar with cross reference to \cref{equations1}.

More generally, I would actually be in favor of making each production rule in syntax.tex its own listing, with a systematic way of creating a cross reference to a specific production rule with something like \cref{production:statement}. With precise cross references like that, the need to duplicate the production in other places of the document is more or less eliminated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the simple reference; a more precise cross-referencing would be good, but I think that should be a separate PR and prioritized.

The syntax of \firstuse[assignment statement!simple]{simple assignment statement} is as follows:
\begin{lstlisting}[language=grammar]
component-reference ":=" expression
( component-reference | der "(" component-reference ")" ) ":=" expression
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without "repeating" the grammar:

A \firstuse[assignment statement!simple]{simple assignment statement} is an assignment statement where the left-hand side of the \lstinline!:=! is a component reference or a derivative.
(The restriction that \lstinline!der! is not allowed inside \lstinline!function! classes also applies to assignments.)
The right-hand side of the \lstinline!:=! is evaluated, and the resulting value is stored into the left-hand side variable or derivative.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied that without the middle-line, and some update of the next paragraph (that already contained the restriction on derivatives.)

@HansOlsson HansOlsson requested a review from henrikt-ma March 12, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect definition of statement within the Modelica grammar

2 participants