fortran-src
fortran-src copied to clipboard
Fortran 90 lexer is not failed if parameter does not have initializer
The following code should lead to an error of Fortran 90 lexer, but it does not:
program main
integer, parameter :: val
end
Why would that be an error?
It seems to me that it is only one way to declare the value of parameter: initialize it in line, where parameter statement is set.
And also, gfortran produces the following error for this code:
test_2.F:2:31:
2 | integer, parameter :: val
| 1
Error: PARAMETER at (1) is missing an initializer
Maybe not lexer, but something else should be failed. :-)
Unlike gfortran, fortran-src is not a compiler, it's a frontend with emphasis on lexing, parsing, and syntactic manipulations.
It does know about name resolution as it has a dataflow analyses builtin, but it assumes that you start with a legal program. It would be very nice if we had a more suspicious name resolution procedure but at the moment we don't.
If you want to work on that, I'm sure @mrd can give you some pointers.