Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax errors in Modelica Standard Library #625

Closed
modelica-trac-importer opened this issue Jan 14, 2017 · 5 comments
Closed

Syntax errors in Modelica Standard Library #625

modelica-trac-importer opened this issue Jan 14, 2017 · 5 comments
Labels
bug Critical/severe issue L: Media Issue addresses Modelica.Media P: low Low priority issue
Milestone

Comments

@modelica-trac-importer
Copy link

modelica-trac-importer commented Jan 14, 2017

Modified by dietmarw on 12 Oct 2011 13:41 UTC
In Modelica Standard Library 3.2_build5, Released Dec 13, 2010 there are several syntax errors:

Math/package.mo

Line 2749: Two commas in (LU,,info)
Line 2925: Two commas in (sigma,,V)

Media/Water/IF97_Utilities.mo

Line 3820: .5132047 (should be 0.5132047 a leading number is needed in a real value)

Math/Nonlinear.mo

Functions as input arguments are used as described in the documentation of the file. The syntax specification in Modelica Language Specification, Chapter 12.4.2. should also be added to the syntax definition in Appendix B.


Reported by roland on 12 Oct 2011 13:36 UTC
In Modelica Standard Library 3.2_build5, Released Dec 13, 2010 there are several syntax errors:

Math/package.mo

Line 2749: Two commas in (LU,,info)
Line 2925: Two commas in (sigma,,V)

Media/Water/IF97_Utilities.mo

Line 3820: .5132047 (should be 0.5132047 a leading number is needed in a real value)

Math/Nonlinear.mo

Functions as input arguments are used as described in the documentation of the file. The syntax specification in Modelica Language Specification, Chapter 12.4.2. should also be added to the syntax definition in Appendix B.


Migrated-From: https://trac.modelica.org/Modelica/ticket/625

@modelica-trac-importer
Copy link
Author

Modified by dietmarw on 12 Oct 2011 13:41 UTC

@modelica-trac-importer
Copy link
Author

Comment by hansolsson on 12 Oct 2011 13:43 UTC
Having two commas is correct Modelica syntax; thus that is not an error in Math/package.mo (it indicates that an output argument between LU and info is ignored by the caller).

The missing leading '0' is an error for the number .5132047

The last part with Math/Nonlinear.mo seems like an issue in the spec that is already being handled.

@modelica-trac-importer
Copy link
Author

Comment by stefanv on 12 Oct 2011 13:47 UTC
Regarding numbers with no leading zero, the specification (section 2.4.1) is mildly ambiguous, but the text only says that at least one digit must be present (somewhere). To me, this means that "1." and ".1" are valid numbers, whereas "." by itself is not.

@modelica-trac-importer
Copy link
Author

Comment by dietmarw on 12 Oct 2011 14:00 UTC
I was a bit quick here and already opened up #626 for the specification part. Hans feel free to close that one as a duplicate.

The real number thing I fixed in 6becfd1 for maintenance/3.2 and in c29c8b7 for trunk.

Stefan: Since we actually did the number clean up earlier to avoid numbers like .xxx or xxx. in the MSL I simply fix this and close this ticket.

@modelica-trac-importer modelica-trac-importer added the L: Media Issue addresses Modelica.Media label Jan 14, 2017
@modelica-trac-importer
Copy link
Author

Comment by jmattsson on 12 Oct 2011 14:24 UTC
Replying to [comment:3 stefanv]:

Regarding numbers with no leading zero, the specification (section 2.4.1) is mildly ambiguous, but the text only says that at least one digit must be present (somewhere). To me, this means that "1." and ".1" are valid numbers, whereas "." by itself is not.

I agree, and it would probably be nice to it more explicit in the specification. Most programming languages allows both "1." and ".1" (but not ".").

However, there is a problem with "1.": when combined with ".+", "./", etc, an ambiguity arises.

  • 1. / 2 is "1.0 divided by 2"
  • 1 ./ 2 is "1 element-wise divided by 2" (allowed but same as 1 / 2)
  • 1./ 2 can be interpreted as either of the first two forms
    Most scanner generators will generate a scanner that interprets the last form the same as the first form, but the formal grammar allows both interpretations.

@modelica-trac-importer modelica-trac-importer modified the milestone: MSL3.2.1 Jan 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Media Issue addresses Modelica.Media P: low Low priority issue
Projects
None yet
Development

No branches or pull requests