You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Fortran grammar specification has several issues:
Kind-specifiers for constants are not supported, e.g. 1.0_8 or 1.0_myKindParameter
kind is not only a keyword inside a declaration, but also an intrinsic function, e.g. i = kind(1.)
Fortran explicitly allows reusing keywords of the language. Keywords are not reserved, you can for example name a variable value or kind. The compiler only fails if the usage is ambigious.
Here is a valid Fortran file:
module test
implicit none
public
integer, parameter :: rk = kind(1.0)
real(kind=rk), parameter :: eps = epsilon(1._rk)
integer, parameter :: value = 10
end module test
And the respective errors I obtain:
> F2x -t @_bindc.f90.t -t @_ctypes.py.t test.f90
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home_local/zoel_ml/F2x/src/F2x/main.py", line 165, in main
src.parse()
File "/home_local/zoel_ml/F2x/src/F2x/source.py", line 180, in parse
self.tree = grammar.parse(self.source)
File "/home_local/zoel_ml/F2x/src/plyplus/plyplus.py", line 575, in parse
return self._grammar.parse(text)
File "/home_local/zoel_ml/F2x/src/plyplus/plyplus.py", line 716, in parse
raise ParseError('\n'.join(self.errors))
plyplus.plyplus.ParseError: Syntax error in input at 'kind' (type T_KIND) line 5 col 30
Syntax error in input at '_' (type T_UNDERSCORE) line 6 col 47
Syntax error in input at 'value' (type T_VALUE) line 7 col 25
Could not create parse tree!
The text was updated successfully, but these errors were encountered:
The Fortran grammar specification has several issues:
1.0_8
or1.0_myKindParameter
kind
is not only a keyword inside a declaration, but also an intrinsic function, e.g.i = kind(1.)
value
orkind
. The compiler only fails if the usage is ambigious.Here is a valid Fortran file:
And the respective errors I obtain:
The text was updated successfully, but these errors were encountered: