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

Fortran 90 lexer is not failed if parameter does not have initializer #114

Open
foxtran opened this issue Jan 10, 2020 · 4 comments
Open

Comments

@foxtran
Copy link

foxtran commented Jan 10, 2020

The following code should lead to an error of Fortran 90 lexer, but it does not:

      program main
      integer, parameter :: val
      end
@madgen
Copy link
Member

madgen commented Jan 10, 2020

Why would that be an error?

@foxtran
Copy link
Author

foxtran commented Jan 10, 2020

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

@foxtran
Copy link
Author

foxtran commented Jan 10, 2020

Maybe not lexer, but something else should be failed. :-)

@madgen
Copy link
Member

madgen commented Jan 10, 2020

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.

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

No branches or pull requests

2 participants